$ perle 'my %ent = qw{& & < < > >}; say "... < & > ..." =~ s/([&><])/$ent{$1}/gr'
... < & > ...
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: <%-{-{-{-<
In reply to Re: Brace in the replacement part of a regular expression substitution
by AnomalousMonk
in thread Brace in the replacement part of a regular expression substitution
by luc.bouge
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |