in reply to Need help in sorting the array
I believe this calls for an application of the GRT (untested):
my @newArr = map { # put it all back together join '', @$_ } sort { # dereference and sort numerically by 2nd element $a->[1] <=> $b->[1] } map { # break off the digits and put in an anonymous array [ split /(\d+)/ ] } @arr;
@_=qw; Just another Perl hacker,; ;$_=q=print "@_"= and eval;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Need help in sorting the array
by johngg (Canon) on Dec 10, 2009 at 15:25 UTC | |
by perlCrazy (Monk) on Dec 10, 2009 at 17:08 UTC | |
by bv (Friar) on Dec 10, 2009 at 16:45 UTC |