use PDL; my $data = pdl(qw(4 3 7 8 9 49 12 23 43)); my $largest_idx = $data->maximum_ind; my $largest = $data->at($max_idx); print "Largest number is $largest, at offset $largest_idx\n";