Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi!
Okay, I have an AoA (or basically a matrix) and I want to sort all the entries based on one column. So I need something like
1 3 4 5 5 1 2 4 sorting on the second column (or array [ ][ ]);
to become
5 1 2 4 1 3 4 5
I have thought about doing this:
@temp = [sort {$b cmp$a} @{$array [ ]}];
but it doesn't work. I'm not super amazing at perl, so any @_ syntax thrown out I would need to be explained! Any help is appreciated!
Thanks!
Code tags added by GrandFather
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sorting AoA
by moritz (Cardinal) on Jul 28, 2008 at 19:51 UTC |