I was under the impression that "average" meant mean.
sub sumIt(@)
{
my $total = 0;
$total += $_ for (@_);
return $total; # This line might not be needed...
}
sub avg(@)
{
my @arr = @_;
my $arrSize = @arr; # scalar(@arr) is the array size - or one less
(last index). Double check
return simIt(@arr) / $arrSize;
}
1;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
