- or download this
s/(key1|key2|key3)/$hash{$1)/g;
- or download this
my $re = join '|', keys %dict;
$re = qr|($re)|;
s/$re/$hash{$1}/g;
- or download this
use Regexp::Assemble;
my $ra = Regexp::Assemble->new;
$ra->add($_) for keys %dict;
- or download this
s/(\w+)/$dict{$1}||$1/ge;
- or download this
s/(\w+)(?(?{$dict{$1}})|(?!))/$dict{$1}/g;