Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: List::MoreUtils before, after and ... between? (SMoP)

by tye (Cardinal)
on Feb 21, 2012 at 15:59 UTC ( #955340=note: print w/ replies, xml ) Need Help??


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        


Comment on Re: List::MoreUtils before, after and ... between? (SMoP)
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://955340]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (16)
As of 2015-07-06 13:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (75 votes), past polls