3. | stats.pl  

#!/usr/bin/perl

use 5.018;
use strict;
use warnings;
use autodie;

my $total = 0;
my $count = 0;
my $max   = undef;
my $min   = undef;
my $sd_m  = 0;
my $sd_s  = 0;

while(<>) {
    if(my($value) = $_ =~ m{^\s*(\d+(?:[.]\d+)?|[.]\d+)}) {
        $value = 0 + $value;
        $total += $value;
        $count++;
        if(not defined($min) or $value < $min) {
            $min = $value;
        }
        if(not defined($max) or $value > $max) {
            $max = $value;
        }
        my $old_m = $sd_m;
        $sd_m += ($value - $old_m) / $count;
        $sd_s += ($value - $old_m) * ($value - $sd_m);
    }
}

say "Total:   $total";
say "Count:   $count";

exit if $count == 0;

say "Average: " . ($total / $count);

my $std_dev = sqrt($sd_s / ($count - 2));
say "Std Dev: $std_dev";

say "Min:     $min";
say "Max:     $max";