I don't know if it will help, but I just saw this on comp.lang.perl.misc,concerning a similar problem.

#by Janek Schleicher #favor using a module: use Regexp::Subst::Parallel; my $replaces_str = subst($string, qr/A/ => 'Y', qr/B/ => 'Z' ); ###################################### #Discussion: #using a hash my %substitute = (A => 'Y', B => 'Z'); my $keys = join "|", keys %substitute; s/($keys)/$substitute{$1}/g; #Disadvantages are that it becomes slow, #when there a lot of different expressions, #and it can lead to problems if there are some regexp characters insid +e. ############################################### #It's often extremely useful, #if you know that the matches can be matched with a more general one, #e.g. they are words: s/(\w+)/$substitute{$1} || ""/ge;

In reply to Re: Looking for a Better Way to Substitute Characters (accents to HTML) by zentara
in thread Looking for a Better Way to Substitute Characters (accents to HTML) by svsingh

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.