use strict; use warnings; my $f1 = '1.txt'; my $f2 = '2.txt'; my (@strings, $text); open (FH, $f1) || die; chomp(@strings = ); open (FH, $f2) || die; $text = join '', ; $text =~ s/\Q$_\E/******/g for @strings; ### Make sure it's treated as string and not expression open (FH, ">$f2") || die; print FH $text; close FH; #### find search #### a bunch of words with find and search and some other words #### a bunch of words with ****** and ****** and some other words