Earth Host1 Jupiter Host2 Venus Host3 Mars Host4 #### use Modern::Perl; use File::Slurp qw/read_file write_file/; my $logFile = 'log.txt'; my $oldNewFile = 'oldNewFile.txt'; my $text = read_file $logFile; for(read_file $oldNewFile){ my ($old, $new) = split; $text =~ s/\b$old\b/$new/g } say $text; #write_file( $logFile, $text );