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

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;

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 perusing the Monastery: (4)
As of 2016-10-23 22:57 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (302 votes). Check out past polls.