in reply to generate new files

Okay, I have had a closer look at this one.

First of all, that edit sub seems to be a bit of a red herring, as it appears to have nothing to do with the rest of the code.

I have modified the rest of the code so it will run standalone, and enabled strict and warnings.

I also created a dummy cvsin file to read from.

So, we have....

darren@barney:~/perlmonks$ cat csvin replace_me merry xmas hello world perlmonks replace_me just another Perl hacker,

And the modified code...

#!/usr/bin/perl -w use strict; my $rim1_thecode = "csvout"; my $CSV_file = "csvin"; my $thecode = "replace_me"; if ($rim1_thecode ne "") { ##generate RIM1 csv file## open (CSVIN, "<$CSV_file") or die "Can't open $CSV_file: $!\n"; my $outcsv_file = $rim1_thecode."\.csv"; open (CSVOUT, ">$outcsv_file") or die "Can't open $outcsv_file: $! +\n"; my @lines = <CSVIN>; for my $line (@lines) { ##substitute $thecode with RIM1 transaction code## $line =~ s/$thecode/$rim1_thecode/; print CSVOUT $line; } close CSVIN; close CSVOUT; }

Which when run creates the file csvout.csv, which looks like so..

darren@barney:~/perlmonks$ cat csvout.csv csvout merry xmas hello world perlmonks csvout just another Perl hacker,

As you can see, all the instances of "replace_me" have been replaced with "csvout", which is exactly as expected. However, I'm quite certain this isn't what you are trying to achieve. I think what you need to do now is explain as clearly as possible precisely what it is you are trying to do, and then we may be able to help you further.

Cheers,
Darren :)