Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: adding a column of integers

by Smylers (Pilgrim)
on Sep 02, 2004 at 16:10 UTC ( [id://387967]=note: print w/replies, xml ) Need Help??


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

If you're in the mood for doing sneaky tricks with -n then why not be really sneaky:

perl -lne '$;+=$_}{print$'

Smylers

Replies are listed 'Best First'.
Re^3: adding a column of integers
by Anonymous Monk on Sep 02, 2004 at 21:19 UTC

      That's overkill; miss out 3 of the characters and it still works:

      perl -lpe '$-+=$_}{$_=$-'

      Smylers

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-04-19 12:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found