in reply to List::MoreUtils before, after and ... between?
Wow, so many complicated solutions! It's actually quite simple:
my ($seen_opening, $seen_data, $seen_closing); my @filtered = grep { ($seen_opening ||= /DBIC/) # Find opening bound && ($seen_data ||= !/DBIC/) # Find data && !($seen_closing ||= /Dancer/) # Find closing bound } @list;
Using the range operator is possible too.
my @filtered = grep { (/DBIC/ .. /Dancer/) && !/DBIC/ && !/Dancer/ } @list;
Update: Added range operator solution.
|
|---|