in reply to how to sort this?
The following sorts numerically by the number preceeding the 'x', then numerically by the number following the 'x':
@a = sort { my ($a1, $a2) = split(/x/, $a); my ($b1, $b2) = split(/x/, $b); $a1 <=> $b1 || $a2 <=> $b2 } @a;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: how to sort this?
by bobf (Monsignor) on Mar 25, 2006 at 06:00 UTC |
In Section
Seekers of Perl Wisdom