Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: Rook question

by Anonymous Monk
on Oct 18, 2012 at 17:18 UTC ( #999779=note: print w/ replies, xml ) Need Help??


in reply to Re: Rook question
in thread Rook question

Let's fold a list.

use List::Util 'reduce'; sub total { return reduce { $a + $b } 0, @_; }


Comment on Re^2: Rook question
Download Code
Re^3: Rook question
by squimby (Acolyte) on Oct 19, 2012 at 00:40 UTC
    The above code hardly even resembles Perl as I know it. Got a lot to learn... I've heard at work they use 'map' regularly (I wouldn't say 'frequently'--something about it not processing efficiently with mysql in some contexts). I'll need to read up on that.
          something about it not processing efficiently with mysql in some contexts

      eh? What does map have to do with mysql? O-o


      Peter L. Berghold -- Unix Professional
      Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

      I can't say I'd choose cowdawg's approach for this question, because map is a bit ill suited for this specific problem. Athanasius's is probably the most idiomatic while still being easy to understand.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2014-09-19 23:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (151 votes), past polls