in reply to A little problem
$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.