http://www.perlmonks.org?node_id=1007029


in reply to replace a character based on rule file

G'day lakssreedhar,

You haven't actually asked a question - please take a look at: How do I post a question effectively?

For the scenario you describe, I'd be looking at a positive look-behind assertion - see perlre - Extended Patterns for details.

Here's an example:

$ perl -Mstrict -Mwarnings -E ' my @words = qw{door name dad naming}; for (@words) { s{(?<=na)m}{+d}; say; } ' door na+de dad na+ding

-- Ken