Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: "Junkyard" Puzzle: Average of Numbers (Newbie approach)

by bambam
on May 13, 2001 at 06:09 UTC ( #79986=note: print w/ replies, xml ) Need Help??


in reply to "Junkyard" Puzzle: Average of Numbers

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]}; }


Comment on Re: "Junkyard" Puzzle: Average of Numbers (Newbie approach)
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://79986]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2014-04-18 21:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (472 votes), past polls