Patricia Hinman wrote:
>
> Does anyone know of a routine that will sort arrays by
> size. I need to sort any number of given arrays, and
> operate on the largest to the smallest.
>
> I've just recently learned of the
> @nums = sort{$a<=>$b} @numbers;
>
> hope the answer for arrays is as simple.
use Data::Dumper;
my @AoA = ( [ 1,2,3,4,5 ],
[ 1,2,3,4 ],
[ 1,2,3 ],
[ 1,2,3,4,5,6,7,8 ],
[ 1,2,3,4,5,6 ],
[ 1,2,3,4 ],
[ 1,2,3,4,5,6,7,8,9 ],
[ 1,2 ], );
print Dumper( \@AoA );
@AoA = sort { @$b <=> @$a } @AoA;
print Dumper( \@AoA );
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]