while (<>) { my $i = /ABCD/ ... /EFGH/; print "========\n" if $i == 1; print if $i; }