push @lines, $_ unless $where == 1 or $where =~ /E0/; #### my $foundend; while () { next unless my $where = /START/ .. ($foundend=/END/); # ... } print "found\n" if $foundend.