erez_ez has asked for the wisdom of the Perl Monks concerning the following question:
And I want it to be sorted like:erez[11] dana[22] dana[0] erez[10] erez[1] erez[0] dana[10]
For that I used:dana[0] dana[10] dana[22] erez[0] erez[1] erez[10] erez[11]
But it is not done correctly. I also tried to replace the '&' with '||' but it didnt help. Any suggestions? Thanks, Erez.my @new_list=sort {(($a) cmp ($b)) & ($a =~ /\[(\d+)/)[0]<=> ($b =~ /\ +[(\d+)/)[0]} @split_list;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sort options
by FunkyMonk (Bishop) on Aug 03, 2008 at 15:14 UTC | |
by Perlbotics (Archbishop) on Aug 03, 2008 at 17:09 UTC | |
by erez_ez (Acolyte) on Aug 03, 2008 at 15:40 UTC | |
by jethro (Monsignor) on Aug 03, 2008 at 16:00 UTC | |
|
Re: Sort options
by pjotrik (Friar) on Aug 03, 2008 at 15:24 UTC | |
by broomduster (Priest) on Aug 03, 2008 at 16:54 UTC | |
by johngg (Canon) on Aug 03, 2008 at 23:10 UTC | |
|
Re: Sort options
by swampyankee (Parson) on Aug 03, 2008 at 17:45 UTC |