|
|
|
Clear questions and runnable code get the best and fastest answer |
|
| PerlMonks |
How to 'peek' at next line while parsing with <>by Anonymous Monk |
| on Jul 11, 2002 at 16:51 UTC ( #181068=perlquestion: print w/ replies, xml ) | Need Help?? |
|
Anonymous Monk has asked for the
wisdom of the Perl Monks concerning the following question:
Using the while (<>) construction takes a file from the command line and parses each individual line of the file (up to the \n). How do I 'peek' at the next line in the file without losing my current place? Doing something like: my $nextLine = <> would skip the current line, but all I want to do is check the next line for before processing the current line. I have written all sorts of convoluted test code, trying to fiddle with line numbers, the @ARGV array, the $_ variable, but nothing has worked so far. Many thanks for your help.
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||