Why bother doing all that work when someone else has already done it for you? I think you'll find the List::Util module in the Scalar-List-Utils bundle will do all you want.
use List::Util; # assume data in @data my $max = max @data; my $min = min @data; my $sum = reduce { $a + $b } @data; my $avg = $sum / @data;
Blessed Be
The Pixel
In reply to Re: Script for MAX and Min
by pixel
in thread Script for MAX and Min
by NodeReaper
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |