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

There don't seem to be many comments in that code, or helpful things like "use warnings;". Try closing OUT before opening COL. What is OUTPUT? Are there perhaps some files whose last line is missing a newline character? Try chomping all your input and adding "\n" to each print.
  • Comment on Re^7: inserting array of data into text file

Replies are listed 'Best First'.
Re^8: inserting array of data into text file
by Anonymous Monk on Jul 13, 2004 at 20:46 UTC
    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);
      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?