in reply to Perl Range operator question
The else clause of your if statement will never execute if ABCD immediately follows EFGH. Try it like this instead:
open IP_FH, '<', 'test.txt' or die "Cannot open 'test.txt' $!"; my ( $match, $found ); while ( <IP_FH> ) { if ( /ABCD/ ... /EFGH/ ) { $match = 1; $found .= $_; } if ( $match ) { $match = 0 ; print "========\n"; print $found; $found = ''; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl Range operator question
by jhuijsing (Acolyte) on Jul 09, 2010 at 00:08 UTC |