Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Efficient way to sum columns in a file

by Random_Walk (Parson)
on Apr 13, 2005 at 12:58 UTC ( #447353=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    use strict;
    ...
        print CSV join ",",@numbers;
        print CSV $/;
    }
    
  2. or download this
    nph>time cat numbers.csv | perl -nle'@d=split /,/;$a[$_]+=$d[$_] for (
    +0..4);END{print join "\t", @a}'
    249959157       249671314       249649377       250057435       249420
    +634
    ...
    real    0m6.45s
    user    0m5.91s
    sys     0m0.07s
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2014-07-29 21:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (228 votes), past polls