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.