my (@temps, @numbers); my ($ind, $maxind, $max) = (-1, -1, $num[0]); for my $num (@numbers) { $ind++; $maxind = $ind, $max = $num if $num > $max; } my $maxtemp = $temps[$maxind];