Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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

by toolic (Bishop)
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?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (15)
As of 2016-02-10 19:05 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (354 votes), past polls