Perl: the Markov chain saw | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
$avg /= @data; basically means same as $avg = $avg / @data. You're dividing $avg by the number of elements in @data and storing the result back in $avg. The tricky part is that computers have this nasty habbit of freaking out on divisions by zero (because technically you can't divide by zero).
A fix would include something like : $avg = scalar(@data) ? $avg /= @data : 0; Beatnik ... Quidquid perl dictum sit, altum viditur. In reply to Re: A little problem
by Beatnik
|
|