Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Array splitting

by bimleshsharma (Beadle)
on Nov 01, 2012 at 08:05 UTC ( #1001776=note: print w/ replies, xml ) Need Help??


in reply to Re: Array splitting
in thread Array splitting

here is quick solution. See if it is useful for you.

sub split_array { my @not_sorted = qw(Ape Arg Beep Circus); my @sorted = sort {$a cmp $b} @not_sorted; my @A = (); my @trash = (); map{$_ =~/^A.*/ ? push(@A,$_):push(@trash,$_)} @sorted; print "\n",@A,"\n"; print "\n",@trash,"\n"; }


Comment on Re^2: Array splitting
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2015-07-05 03:27 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 (60 votes), past polls