Number two was also what I had in mind. Something like the following:
#! /usr/bin/perl use strict ; use warnings ; my $line = <> ; my $queued_line = '' ; chomp $line ; while ( $queued_line = <> ) { chomp $queued_line ; $line =~ m|<(.+?)>| ; print "Found match: [$1] (next line: $queued_line)\n" ; $line = $queued_line ; } $line =~ m|<(.+?)>| ; print "Found match: [$1] (last line)\n" ;
In reply to Re: Re: How to 'peek' at next line while parsing with <>
by DamnDirtyApe
in thread How to 'peek' at next line while parsing with <>
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |