I'm probably missing the boat here, but the documentation claims that since "patterns are processed as double-quoted strings, the normal double-quoted interpolations will work."1
my $foo = "`ls`"; # "Evil" command my $bar = "$foo"; print $bar,"\n";
All you get is:     `ls` I wasn't hoping for a miracle to occur, just that $foo would be translated as literal string '$bar', and that the '$' would be recognized as just another ASCII character, not the end of line anchor. After all, if we're on the subject of evil, now this means that you can put all sorts of wacky stuff in your variable and it gets interpolated as regexp material, or at least jostles your program with a warning:
my $foo = '(?{die})'; s/$foo/XYZ/g; # Eval-group not allowed at runtime, use re 'eval'
Maybe there should be a switch for regexps which cause any interpolated strings to be interpreted as just text and any meaning is disregarded. Of course, you can always do this with \Q and \E...
1Programming Perl, 2nd Ed., pg. 60

In reply to Re^2: Regex Grumblings (Variable Interpolation) by tadman
in thread Regex Grumblings (Variable Interpolation) by tadman

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.