Pls comment.sub sum($) { my $listref = $_[0]; my $sum = 0; map { $sum += $_ } @{$listref}; return $sum; } sub avg($) { my $listref = $_[0]; sum($listref)/@{$listref}; } sub rms($) { my $listref = $_[0]; sqrt(sum([map{(avg($listref)-$_)**2}@{$listref}])/@{$listref}); }
"Argument is futile - you will be ignorralated!"
In reply to How do I get the root mean square of a list? by larryk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |