in reply to Appending new column data to CSV file?
$sum and @numbers need to be declared before the while loop that reads the file. Then after each file is read, statements:$sum += $col5; push @numbers, $col5;
You would need to declare @output before the foreach loop begins.while (my ($i, $num) = each @numbers) { push @{ $output[$i] }, $num/$sum; }
Then after all the files have been read and the info collected, you could print it out like: print OUT join(",", @$_), "\n" for @output;
|
---|
In Section
Seekers of Perl Wisdom