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.
In reply to Re: How do I re-read a line?
by Kanji
in thread How do I re-read a line?
by rbc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |