in reply to Re: (jcwren) Re: Still confused
in thread Still confused
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: Still confused
by tye (Sage) on Apr 11, 2001 at 22:47 UTC | |
by buckaduck (Chaplain) on Apr 11, 2001 at 23:39 UTC |