Perl-Sensitive Sunglasses | |
PerlMonks |
Re: How can I find the index of the biggest element in an array?by GrandFather (Saint) |
on May 27, 2007 at 22:53 UTC ( [id://617776]=note: print w/replies, xml ) | Need Help?? |
Given an array @data containing numeric data:
is not only compact but, somewhat surprisingly perhaps, comparable in speed to caching $data[$idxMax] as shown in most of the other variants. A cache variant is worth using if an expensive calculation is required in the comparison or a very large array is being processed.
In Section
Seekers of Perl Wisdom
|
|