in reply to Matching next line in text file

I want to test the next line in a file to see if it is a certain type, or a new data set, or the end of file. Any idea how I can do this?
my $current = <$handle>; while (my $next = <$handle>){ # your loop here $current = $next; }

In the loop body have the current and the next line available.

Replies are listed 'Best First'.
Re^2: Matching next line in text file
by YYCseismic (Beadle) on Jul 03, 2008 at 21:49 UTC

    I'm not sure I see where to put this chunk of code. I'm thinking that your my $current = <$handle>; and while statement would replace my while (<IN>), but I'm not certain. If so, then I (think I) understand what's going on. Otherwise I'm totally confused. Can you please elaborate?