#!/usr/local/bin/perl use warnings; use strict; my $f1 = '1.txt'; # set up files 1 through 3 my $f2 = '2.txt'; my $f3 = '3.txt'; my (@strings, $text); open (FH, $f1) || die; # open file 1 in a file handle chomp(@strings = ); # take off the line breaks open (FH, $f2) || die; # open file 2 in a file handle $text = join '', ; # joins files 1 and 2? - I don't think I want to do this... $text =~ s/\Q$_\E/$f3/g for @strings; # this is the problem spot, I think... open (FH, ">$f3") || die; print FH $text; close FH;