my %word_map = ( nce => "nse", nse => "nce" ); my $re = join "|", map qr/\Q$_/i, keys %word_map; s/($re)/$word_map{lc $1}/ge; print