Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: List::MoreUtils before, after and ... between?

by toolic (Chancellor)
on Feb 21, 2012 at 15:05 UTC ( #955331=note: print w/ replies, xml ) Need Help??


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

Not very pretty, but it doesn't even go though your whole list once:

use warnings; use strict; use Data::Dumper; my @foo; my $flag = 0; for (qw<eval DBIC::3 DBIC::2 DBIC::1 MyApp::3 MyApp::2 MyApp::1 Dancer +::3 Dancer::2 Dancer::1>) { last if /Dancer/; $flag = 1 if /DBIC/; $flag = 2 if $flag and !/DBIC/; push @foo, $_ if $flag == 2; } print Dumper(\@foo); __END__ $VAR1 = [ 'MyApp::3', 'MyApp::2', 'MyApp::1' ];


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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2014-09-24 05:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (246 votes), past polls