while () { next unless my $where = /START/ .. /END/; print unless $where == 1 or $where =~ /E0/; }