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 = ''; } }
In reply to Re: Perl Range operator question
by jwkrahn
in thread Perl Range operator question
by jhuijsing
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |