You're calculating deviations from the average via
($score - $avg) as you go along. But this
won't work because the "average" isn't the true average
until you're done counting the data! I think
that what you want to do is:
1. Read in all of the data, calculate $number and $sum as you go
2. Calculate $avg from the final $number and $sum
3. Loop through the data again and calculate $totd as you go
Or, you can use the module Statistics::Descriptive to do it for you. Unless this is a homework assignment...
buckaduck
In reply to Re: Re: (jcwren) Re: Still confused
by buckaduck
in thread Still confused
by yabba
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |