# use 'mean' instead of 'avg' as it's unambiguous sub min_max_mean { my ($min, $max, $tot); my $count = @_; $min = $max = $tot = shift; foreach (@_) { $min = $_ if $_ < $min; $max = $_ if $_ > $max; $tot += $_; } return ($min, $max, $tot / $count); }