Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Answer: How can I add all the numbers in an array with out doing a foreach loop?

by furry_marmot (Pilgrim)
on Aug 16, 2006 at 13:29 UTC ( [id://567679]=note: print w/replies, xml ) Need Help??


in reply to Re: How can I add all the numbers in an array with out doing a foreach loop?
in thread How can I add all the numbers in an array with out doing a foreach loop?

I just have to ask how the heck hard is it to write this:

$sum += $_ for @array

And notice there's no foreach loop, which the Camel clearly states is a synonym for for anyway (see "perldoc perlsyn", 'Foreach Loops'), so maybe I'm not clear on what you're asking.

--marmot

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (3)
As of 2024-06-15 03:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.