in reply to a proper sort
@pretty=sort { my @a = $a =~ /(\D+)(\d+)?/; my @b = $b =~ /(\D+)(\d+)?/; $a[0] cmp $b[0] || ($a[1] || 0) <=> ($b[1] || 0) } @not_so_pretty;
Right now, your regex will fail to provide anything in @a/@b if there aren't any numbers.
Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: a proper sort
by ministry (Scribe) on Mar 04, 2005 at 15:21 UTC |