in reply to Re: pattern matching (greedy, non-greedy,...)
in thread pattern matching (greedy, non-greedy,...)

I was gonna suggest using the range op, but it doesn't really help
my @lines; while (<DATA>) { my $is_key = /KEY/; @lines = () if $is_key; if (my $in_range = $is_key .. /PATTERN/) { push @lines, $_; print @lines if $in_range =~ /E0\z/; } }

If one continues to simplify the above, one gets the parent's code.