my $max; my $index; my $x = 0; for ( @myarray ) { $index = $x and $max = $_ if !defined $max or $_ > $max; $x++; } print "The winner is element number $index: $myarray[$index]\n";
In reply to Re: How can I find the index of the biggest element in an array?
by turnstep
in thread How can I find the index of the biggest element in an array?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |