Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Re: "Junkyard" Puzzle: Average of Numbers

by mr.nick (Chaplain)
on May 13, 2001 at 08:15 UTC ( #79993=note: print w/ replies, xml ) Need Help??


in reply to Re: "Junkyard" Puzzle: Average of Numbers
in thread "Junkyard" Puzzle: Average of Numbers

Damn! I did this one without reading a single other post and came out with a sloppier version that yours, but along the same lines (I'm new at this :)

sub find_avg { (eval join"+",@{$_[0]})/(($#{$_[0]})+1); }
I had a hell of a time getting $#array working with $_[0]. I see I over complicated it :)
I'd like to add that these "Junkyard" puzzles, Golf and such are extremely good practice for those of us lower on the curve. Just in the past week or so, I've added quite a bit of knowledge to my base. These remind me much of doing geometric proofs back in middle school. Entertaining as well as educational.

Thank you.


Comment on Re: Re: "Junkyard" Puzzle: Average of Numbers
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2014-07-29 23:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (229 votes), past polls