darren@barney:~/perlmonks$ cat csvin
replace_me
merry xmas
hello world
perlmonks
replace_me
just another Perl hacker,
####
#!/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 = ;
for my $line (@lines) {
##substitute $thecode with RIM1 transaction code##
$line =~ s/$thecode/$rim1_thecode/;
print CSVOUT $line;
}
close CSVIN;
close CSVOUT;
}
####
darren@barney:~/perlmonks$ cat csvout.csv
csvout
merry xmas
hello world
perlmonks
csvout
just another Perl hacker,