Here's a newbie approach w/o using eval : ).
sub s{ push @{$_[0]},0; ${$_[0]}[$#{$_[0]}] += ${$_[0]}[$_] for 0..$#{$_[0]}-1; ${$_[0]}[$#{$_[0]}] /= $#{$_[0]}; pop @{$_[0]}; }
In reply to Re: "Junkyard" Puzzle: Average of Numbers (Newbie approach)
by bambam
in thread "Junkyard" Puzzle: Average of Numbers
by Masem
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |