1234567891011121314151617
#!/usr/bin/perluse strict;use warnings;use List::Util qw/sum/;my @list = (1, 2, 4, 2);my $avg = avg(@list);print $avg, "\n";exit;sub avg { my $sum = sum @_; my $len = scalar @_; return $sum/$len;}