my $total=0; map($total+=$_,@values); my $average = @values ? $total / @values : 0;