my @array = qw(4 3 7 8 9 49 12 23 43); my ($largest, $largest_idx) = ($array1[0], 0); for my $i (1 .. $#array) { ($largest, $largest_idx) = ($array[$i], $i) if $largest < $array[$i]; } print "Largest number is $largest, at offset $largest_idx\n";