I think you will find that Statistics::Descriptive will
be quite handy for your application, and implementing
it to collect the data as you read it as Masem suggests
is very simple.
Update: ar0n has a good point - I tend to want more, uh, descriptive
statistics I guess ;-)