ministry has asked for the wisdom of the Perl Monks concerning the following question:
Here's what I have so far:
@pretty=sort { my @a = $a =~ /(\D+)(\d+)/; my @b = $b =~ /(\D+)(\d+)/; $a[0] cmp $b[0] || $a[1] <=> $b[1] } @not_so_pretty;
This is as close as I have come to getting what I need, unfortunately this sort will return the elements of my list that do not contain numeric characters at the top of the list, as opposed to the required method of an alpha comparison first.
Regards, Ev
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: a proper sort
by dragonchild (Archbishop) on Mar 04, 2005 at 14:51 UTC | |
by ministry (Scribe) on Mar 04, 2005 at 15:21 UTC | |
|
Re: a proper sort
by eieio (Pilgrim) on Mar 04, 2005 at 14:56 UTC | |
|
Re: a proper sort
by Anonymous Monk on Mar 04, 2005 at 15:07 UTC | |
|
Re: a proper sort
by Roy Johnson (Monsignor) on Mar 04, 2005 at 23:32 UTC |