Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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 chanting in the Monastery: (4)
As of 2015-07-05 19:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (67 votes), past polls