http://www.perlmonks.org?node_id=955340


in reply to List::MoreUtils before, after and ... between?

my @stack; for my $level ( qw< eval DBIC::3 DBIC::2 DBIC::1 MyApp::3 MyApp::2 MyApp::1 Dancer::3 Dancer::2 Dancer::1 > ) { last if $level =~ /Dancer/; push @stack, $level; @stack = () if $level =~ /DBIC/; } say for @stack;

(Updated to move 'last' statement above 'push' statement. Thanks, AnomalousMonk.)

- tye