sub std_dev($) { my $listref = $_[0]; my $avg = avg $listref; sqrt(sum([map{($avg-$_)*($avg-$_)}@{$listref}])/@{$listref}); }