in reply to Find and replace from two files

Here's another option using Tie::File:

use Modern::Perl; use Tie::File; tie my @newProps, 'Tie::File', 'new_properties.txt' or die $!; my %newProps = map { /([^=]+)/ => $_ } @newProps; untie @newProps; tie my @oldProps, 'Tie::File', 'old_properties.txt' or die $!; map { /([^=]+)/; $newProps{$1} and $_ = $newProps{$1} } @oldProps; untie @oldProps;

The first map iterates through @newProps, and uses a regex to capture each line's key to build a hash of keys/file lines. The second map iterates through @oldProps, and uses a regex to capture each line's key and, if it exists in the hash, replaces the old property line with the new property line. Changes are automatically written out to the old properties file.

Hope this helps!