Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
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 exploiting the Monastery: (4)
As of 2014-08-23 07:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (172 votes), past polls