Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

by borisz (Canon)
on Aug 16, 2006 at 09:48 UTC ( [id://567645]=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?

Just for fun, does the question make any sense?
use List::Util qw/reduce/; my $sum = reduce { $a + $b } 1..10;
Boris
  • Comment on Re: Answer: How can I add all the numbers in an array with out doing a foreach loop?
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2025-06-24 17:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.