in reply to 2 dimensional array sorting...
Better referred to as elements 0 and 1, you can sort as you want with the or operator. <=> is for numeric comparison, cmp for strings. If @data contains your AoA,
my @sorted_data = sort { $a->[0] <=> $b->[0] or $a->[1] cmp $b->[1] } @data;
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: 2 dimensional array sorting...
by Soko (Sexton) on Mar 27, 2003 at 19:18 UTC |