#!/usr/bin/perl -wT use strict; my @aoa = ([1,2,3], [1,2,3,4,5], [1,2,3,4,5,6,7,8], [1,2,3,4], [1,2,3,4,5,6], ); my $i; my $index = (sort{$$b[1]-$$a[1]}map{[$i++,$#$_]}@aoa)[0]->[0]; print "\$aoa[$index] has the most elements\n"; =OUTPUT $aoa[2] has the most elements