in reply to Re^7: inserting array of data into text file
in thread inserting array of data into text file

with warning -w i am getting no feedback at all this si the code i have just tried, with no success in completing the task!
open (FILE, "<$file"); open (OUT, ">TRUE_OUTPUTS"); open (FILE2, "<$file2"); open (OUT2, ">COMPARE"); while (<FILE>) { chomp $_; if ($_ =~ m/^\d\s+\d/) {print OUT "$_\n"} } close (FILE); while (<FILE2>) { chomp $_; push @col, $_ =~ m/(\S+\s+\S+)/; } close (FILE2); $size = scalar @col; print $size; open(COL, "<TRUE_OUTPUTS"); while(<COL>) { chomp $_; $_ =~ s/(\S\s+\S)/$1 $col[$i++]/; print OUT2 "$_\n"; } close(COL); close(OUT2);

Replies are listed 'Best First'.
Re^9: inserting array of data into text file
by ysth (Canon) on Jul 13, 2004 at 20:54 UTC
    Close OUT before opening COL.

    What exactly is the problem you are seeing?

      of course, silly....cheers but why should it work ok for 90% data then stop is the question, is it because of the buffer?
        Yes. Whatever is left in the buffer isn't actually written out to the file yet. You don't actually need two opens of the file; you could open it for read/write, write to it, seek back to the beginning, and read from it.