#!/usr/bin/perl -wT use strict; my @lol = ([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 $index = 0; $index = $#{$lol[$index]} < $#{$lol[$_]} ? $_ : $index for 0 .. $#lol; print "\$aoa[$index] has the most elements\n"; =OUTPUT $aoa[2] has the most elements