my @array1 = qw(4 3 7 8 9 49 12 23 43); my $largest = (sort {$b <=> $a} @array1)[0]; my ($index) = grep {$array1[$_] ~~ $largest} 0..$#array1; print "Number = $largest, Index = $index\n";
In reply to Re: How can I find the index of the biggest element in an array?
by simmisam
in thread How can I find the index of the biggest element in an array?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |