Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: adding a column of integers

by Eimi Metamorphoumai (Deacon)
on Sep 02, 2004 at 14:19 UTC ( [id://387920]=note: print w/replies, xml ) Need Help??


in reply to Re: adding a column of integers
in thread adding a column of integers

Or more verbose, but more understandable (without delving into the actual expansion of -n)
perl -lne '$sum+=$_; END{print $sum}'
The END block is executed after everything else. You can also use a corresponding BEGIN block before anything else runs, and there are others (CHECK and INIT, having to do with compile time) for fancy stuff.

Log In?
Username:
Password:

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

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

    No recent polls found