You could always just sort it and then take the highest one. I'm not sure how that compares speed wise with just scanning threw 1 by 1. Of course you could just keep a $counter and increment it when adding and not decrement it when removing. Then there is no need to find the highest because you remember it.
my $highest; for (@array) { # or keys %hash $highest = $_ if $_ > $highest; }
In reply to Re: largest number inside array/hash
by eric256
in thread largest number inside array/hash
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |