Hey all.
Here is a small sample of a series of regex substitutions strings:
s/^\s+\(Text [aA].* (\d+:\d+ .*$)/\.T1 "$1/g; s/^\s+\(Text [rR].* (\d+:\d+ .*$)/\.T2 "$1/g;

Here is also a hash that is heading in the right direction ... I think ;-)

%chartran = ( agrave => "s/\\\xE0/\\\[agrave]/og", aacute => "s/\\\xE1/\\\[aacute]/og", acirc => "s/\\\xE2/\\\[acirc]/og", auml => "s/\\\xE4/\\\[auml]/og", Agrave => "s/\\\xC0/\\\[Agrave]/og", Aacute => "s/\\\xC1/\\\[Aacute]/og", );
I cycle through this hash as follows, and I know there is a simpler way to do this as well, though, here is what I have got so far:
while (<VRUN>) { foreach $testchar ( keys %chartran ) { if (eval ( "$chartran{$testchar}" )) { ... write out results .... } } }

So I know I could do all this really simply. Looked at qr// and like this idea, and I think the solution is an eval or an /ee modifier, but how, exactly :)


In reply to large hash of regex substitution strings by scodes

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.