Please help, I am completely new to Perl but need to write a script that
does the following:

I have two directories DIR1 and DIR2 each containing files named LV1-
LV960.txt.

I need to concatenate the files in DIR1 with the files in DIR2 and put
them in DIR3.  So DIR3 will now have files named LV1-LV960.txt.

I'm using the following script:

use warnings;

for ($count = 1; $count <= 960; $count++)
{
  open OUT, ">lv${count}.txt" or die "Cant open data.txt";

  if (open INA, "<a/lv${count}.txt") {
          print OUT $_;
        }
        close INA;
   }
   if (open INB, "<a/lv${count}.txt") {
          print OUT $_;
        }
        close INB;
   }

}
   close OUT;
This works ok except that I get a huge string of "readline on closed
filehandle INA....." and if a file is not found it is written out anyway
with a size of 0.  I'd like to not write the file at all if it's not there.
Unfortunately the numbers in the filenames are not consecutive, so althought
they go up to 960, there really are only about 242 of them.

Thanks,
Debbie



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to