TIMTOWTDI, if you don't mind me plugging one of my own modules, File::Replace:
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;
Or, if a single filehandle is too much magic for your taste:
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;
Note: This is a re-post of a node that was lost.