Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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

by toolic (Bishop)
on Feb 21, 2012 at 15:05 UTC ( [id://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' ];

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-03-29 11:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found