N, Guruguhan (GEAE, Foreign National, EACOE) wrote:
> Hi All,
>            I have a multi dimensional array build like this "
> $array[$i][$j]". This array has some 50 values and I would like to
> sort this in ascending order. Can somebody tell me how to do this?  
> 

Quick and easy (but certainly not the most efficient):

# Given 2-d array @array
my $pos = 0;   # Position in the "horiztonal" to sort on

@array = sort {$a->[$pos] <=> $b->[$pos]} @array;

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to