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

If that is all the code, you have a few issues:
  1. You don't use strict or warnings. Turning them on will be very instructive and helpful.
  2. You close the filehandle COL without opening it.
  3. Why aren't you just appending?
    my $i = 0; while (<COL>) { print OUT2 "$_ ", $col[$i++], "\n"; }

You made it more complicated than it needed to be.

------
We are the carpenters and bricklayers of the Information Age.

Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

I shouldn't have to say this, but any code, unless otherwise stated, is untested

Replies are listed 'Best First'.
Re^8: inserting array of data into text file
by Anonymous Monk on Jul 13, 2004 at 15:42 UTC
    sorry still does not use the whole contents of the array. I need it in column data so its easier to manuplate later
      At this point, I'm going to stop trying to read your mind. If you want me to help further, you will need to provide the following:
      1. A set of unambiguous requirements describing exactly what this program is supposed to do
      2. A set of example inputs
      3. A set of expected outputs

      No code. Just those documents.

      ------
      We are the carpenters and bricklayers of the Information Age.

      Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

      I shouldn't have to say this, but any code, unless otherwise stated, is untested

        ok, thanks, 1) basically open file "data" which contains 2 columns of numerical data approx 400 lines. Copy this data to another file "complete"
        e.g. file "complete" 0 1 1 0 1 0 e.g. file data 0.521 0.365 0.258 0.456 0.211 0.912 so output would be: 0 1 0.521 0.365 1 0 0.258 0.456 1 0 0.211 0.912
        thanks,