my $limit = $array[0][0]; for(my $i = 1; $i <= $#array; $i++) { my $chk = $array[$i][0]; $limit = $chk if($chk lt $limit); } print "Smallest ID is $limit\n";