Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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 ( #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? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2023-09-23 17:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?