I'm writing a script to read a large file(>10 GB) and write the data from an array to the end of each line in that file. Here is my code
my $count=0;
while(my $lines = <$FILE>){
seek $FILE, length($lines), 1;
print $FILE "\t", $array[$count];
$count++;
}
But I think I'm wrong in finding the end-of-line using seek method. I couldn't get my head around this. Can anyone please see whats wrong in this code. before processing..
my 1st line
my 2nd line
my 3rd line
After processing....
my 1st line data1
my 2nd line data2
my 3rd line data3
data1,data2,data3 are in the @array.
Details on the code:
- FILE is opened in +< mode (read/write)
- FILE lines are tab delimited.
- @array holds the data1,2...
Issues:
- Moving the pointer to end of each line
Thanks,
Robin