3. | stats
#!/usr/bin/perl
use 5.010;
use strict;
use warnings;
use autodie;
use Statistics::Descriptive;
my $stat = Statistics::Descriptive::Full->new();
while(<>) {
chomp;
$stat->add_data($_);
}
if($stat->count == 0) {
print "No data\n";
exit;
}
printf("Total: %8u\n", $stat->sum());
printf("Count: %8u\n", $stat->count());
printf("Mean: %12.3f\n", $stat->mean());
printf("Median: %12.3f\n", $stat->median());
printf("Std-dev: %12.3f\n", $stat->standard_deviation());
printf("Minimum: %12.3f\n", $stat->min());
printf("Maximum: %12.3f\n", $stat->max());
printf("Variance: %12.3f\n", $stat->variance());