Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2014-11-27 02:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (178 votes), past polls