# Calculate the average by adding the parameters and # dividing them by the number of elements. sub avg { my $sum = 0; $sum += $_ for @_; return $sum / @_; }