use strict; use warnings; my ($a, $b, $c) = @ARGV; open(FILE, "$a"); my $text=do {local $/; }; close FILE; my %mymatch = $text =~ m/^\s*(.*?)\s*\=\s*(.*?)\s*$/igm; open(FILE, "$b"); my $maintext=do {local $/; }; close FILE; foreach my $myfnd (sort {length($b) <=> length($a)} keys %mymatch) { $maintext =~ s/\Q$myfnd\E/$mymatch{$myfnd}/ig; } open(FILE,">$c"); print FILE $maintext; close FILE;