in reply to Looping through end of file once a match is found

my $found_date = 0; LINE: while ($currentfile=<FILE>) { if (!$found_date and $currentfile =~ /^\d{6}/){ $match_date = substr($currentfile,52,10); if ($search_date eq $match_date) { $found_date = 1; } } next unless $found_date; print RESULTS "$currentfile"; }

Replies are listed 'Best First'.
Re^2: Looping through end of file once a match is found
by thundergnat (Deacon) on Jun 21, 2005 at 16:18 UTC
    while ($currentfile = <FILE>) { if ($currentfile =~ /^\d{6}/ and $search_date eq substr($currentfi +le,52,10) { print RESULTS $currentfile; print RESULTS while <FILE>; } }

    Oops. This was supposed to be a reply to the OP, not Transient.