On 5/9/07, Rob Dixon <[EMAIL PROTECTED]> wrote:
Steve Bertrand wrote:
>> but if they appear in the file in a different sequence then you also
>> need to rewind and start looking at the beginning of the file once
>> again like this:
>>
>>  ID:
>>  foreach my $prime_id ( @id_hits ) {
>>    while ( my $line = <$AFILE> ) {
>>      if ( $line =~ /$prime_id/ ) {
>>        print "$line\n";
>>        seek $AFILE, 0, 0;
>>        next ID;
>>      }
>>    }
>>  }
>>
>
> Would using:
>
> last(); # Break from while back to foreach
>
> ..instead of
>
> next(ID);
>
> ... not produce the same result here?

Yes, that would be equivalent.

Rob

Just a technical nitpick, but it is only equivalent because there is
no code after the while loop.  If there were code then the last would
let it execute, but the next(ID) would not.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to