my $howMany = @colval; my $total = 0; foreach my $val ( @colval ) { $total = $total + $val; } my $avg = $total / $howMany;