Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Think about Loose Coupling
 
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 wandering the Monastery: (13)
As of 2014-04-18 17:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (471 votes), past polls