Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Efficient way to sum columns in a file

by eibwen (Friar)
on Apr 13, 2005 at 06:51 UTC ( #447281=note: print w/ replies, xml ) Need Help??


in reply to Efficient way to sum columns in a file

With regard to your creation of an array and subsequent iteration, it is possible to index the array returned by split and therefore avoid the subsequent iteration:

$sum += (split(/,/))[5];

While indexing in this fashion is useful, I think the @F method would be faster in this case.


Comment on Re: Efficient way to sum columns in a file
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (19)
As of 2015-07-01 20:12 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 (19 votes), past polls