more useful options | |
PerlMonks |
Re: How to add column into array from delimited tab fileby NetWallah (Canon) |
on Feb 17, 2014 at 04:05 UTC ( [id://1075120]=note: print w/replies, xml ) | Need Help?? |
You have the right idea, in collecting data into your (hopefully declared earlier) arrays : @data1, @data2 etc. The problem area is when you open and write to the output file WITHIN the read loop for each row. You need to move the output file open and Write OUTSIDE the file read loop, something like this: (Made some adjustments to localize the file handle, and use the "3 argument" open - see other writeups to understand why this is a good idea.
What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?
In Section
Seekers of Perl Wisdom
|
|