Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Appending new column data to CSV file?

by Cristoforo (Deacon)
on Aug 04, 2013 at 20:47 UTC ( #1047826=note: print w/ replies, xml ) Need Help??

in reply to Appending new column data to CSV file?

In the while loop, these 2 statements:

$sum += $col5; push @numbers, $col5;
$sum and @numbers need to be declared before the while loop that reads the file. Then after each file is read, statements:
while (my ($i, $num) = each @numbers) { push @{ $output[$i] }, $num/$sum; }
You would need to declare @output before the foreach loop begins.

Then after all the files have been read and the info collected, you could print it out like: print OUT join(",", @$_), "\n" for @output;

Comment on Re: Appending new column data to CSV file?
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2015-11-25 17:07 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (683 votes), past polls