Reputation: 1
This is my problem.
I need to copy 2 columns each from 7 different files to the same output file. All input and output files are CSV files. And I need to add each new pair of columns beside the columns that have already been copied, so that at the end the output file has 14 columns.
I believe I cannot use
open(FILEHANDLE,">>file.csv").
Also all 7 CSV files have nearlly 20,000 rows each, therefore I'm reading and writing the files line by line.
It would be a great help if you could give me an idea as to what I should do.
Thanx a lot in advance.
Upvotes: 0
Views: 416
Reputation: 5308
Text::CSV is probably the way to access CSV files.
You could define a csv handler for each file (including output), use getline
or getline_hr
(returns hashref) methods to fetch data, combine it into arrayrefs, than use print
.
Upvotes: 1
Reputation: 76898
Provided that your lines are 1:1 (Meaning you're combining data from line 1 of File_1, File_2, etc):
Upvotes: 2