in reply to Re: Re: complicated sorting issue
in thread complicated sorting issue
my %lookup = do { my $i = 1; map { $_ => $i++ } qw( S M L XL ); }; my @sorted_values = map { $_->[0] } sort { $a->[2] cmp $b->[2] || $lookup{$a->[1]} <=> $lookup{$b->[1]} } map { my ($x, $y) = /\w+:\s(\w+),\s\w+:\s(\w+)/; [ $_, $x, $y ] } @strings;
------
We are the carpenters and bricklayers of the Information Age.
Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: complicated sorting issue
by Anonymous Monk on Apr 09, 2004 at 20:20 UTC |