use warnings; use strict; use File::Replace 'replace'; my $lookuptxtfile = "lookup.txt"; my $fh = replace($lookuptxtfile); while (<$fh>) { s/The action failed./failed_build/g; print $fh $_; } close $fh; #### use warnings; use strict; use File::Replace 'replace3'; my $lookuptxtfile = "lookup.txt"; my ($infh,$outfh,$repl) = replace3($lookuptxtfile); while (<$infh>) { s/The action failed./failed_build/g; print $outfh $_; } $repl->finish;