while (<>) { print unless $count = /^MYTAG1/ .. /^MYTAG2/ and not $count =~ /E0/; }