http://www.perlmonks.org?node_id=80113


in reply to "Junkyard" Puzzle: Average of Numbers


This is 37 chars. I saw Abigail do something like this on clpmisc:
sub average1 { local$"="+";eval("@{$_[0]}")/@{$_[0]} }
This looks prettier when dealing with an ordinary list:
sub average2 { local$"="+";eval("@_")/@_ }
In which case this would be shorter:
sub average3 { eval(join"+",@_)/@_ }
The last one is the same as no_slogan's.

John.
--