in reply to Brace in the replacement part of a regular expression substitution

Further to kcott's post:

$ perle 'my %ent = qw{& &amp; < &lt; > &gt;}; say "... < & > ..." =~ s/([&><])/$ent{$1}/gr'
... &lt; &amp; &gt; ...

luc.bouge:   Also see haukex's article for a very useful technique to dynamically prepare a search (sub-)regex from a "translation" hash like %ent.


Give a man a fish:  <%-{-{-{-<