in reply to SOLVED!!!: search contents of one file and replace with contents of another to make a new file

Welcome vcorby,

Your script isn't doing what you think! Please look at 'split'. You need to 'slurp' the file into an array or use a loop to get your first file. (untested)

my @strings = (); open (my $F1, "<", $f1) || die "! open-100 $!";; # open file 1 while ( my $input = <$F1> ) { chomp( $input ); # take off the line breaks $strings[$#strings] = $input; } close $F1;

And life will be easier for you if you start using the 3 parameter 'open' from the beginning:

open (my $F3, ">", $f3 ) || die "! open-300 $!";
This gives you a start and ask more as you get closer.

Note: I like to number my 'die's so it's quicker to find the problem. If you have a 50K line script, you'll be glad you did :-).

Regards...Ed

"Well done is better than well said." - Benjamin Franklin

  • Comment on Re: search contents of one file and replace with contents of another to make a new file
  • Select or Download Code