Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Rookie question

by Athanasius (Abbot)
on Oct 18, 2012 at 02:57 UTC ( #999659=note: print w/ replies, xml ) Need Help??


in reply to Rook question

Hello squimby, and welcome to the Monastery!

Any tips for 'Perl'ifying this?

Building on NetWallah’s answer:

sub total { my $sum = shift; $sum += $_ for @_; return $sum; }

See shift and Statement Modifiers.

Update: Also read-up on $_ in General Variables.

Hope that helps,

Athanasius <°(((><contra mundum


Comment on Re: Rookie question
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2015-02-28 05:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    On my keyboard, Caps lock is:








    Results (459 votes), past polls