in reply to Re: How to compute the avg of a column of numbers
in thread How to compute the avg of a column of numbers

Divide by zero protection?

my $average = @values ? $total / @values : 0;

Replies are listed 'Best First'.
Re: Re: Re: How to compute the avg of a column of numbers
by Limbic~Region (Chancellor) on Mar 31, 2004 at 21:36 UTC
    pbeckingham,
    Sure, among other things. I left error handling up as an task for the reader.
    next if ! $col[3];
    Cheers - L~R