in reply to How do I re-read a line?
You can use seek to 'rewind' a file handle...
while(<$fh>) { # Make a note of the line length # in case we need to rewind $fh my $line = length; chomp; # ... if ( /^\d-RECORD$/ ) { # rewind $fh to the beginning of # the current line, so <$fh> can # re-get it. seek( $fh, 0 - $line, 1 ); last; } # ... }
--k.
|
|---|