Actually, Perl doesn't reinterpolate strings. Two backslashes should be enough. This sounds like a bug.

As an example, if I do: $str= "C:\\Windows" and then try to use $str in a regular expression: if(  $path =~ /^$str/i  ) { then this won't work. But that is because I made a mistake. I should have written: if(  $path =~ /^\Q$str\E/i  ) { to tell the regular expression that I wanted it to parse $str as a string and not as a regular expression. (I also made a mistake in trying to use a regular expression to compare file paths as the resulting code is not portable.)

I have a hard time coming up with cases other than regular expressions and eval where it is easy to get Perl to interpolate a string a second time. Perhaps you could do some more digging and find where this second interpolation is happening so that a fix could be made (or so I could understand why it isn't a bug in this case).

        - tye (but my friends call me "Tye")

In reply to (tye)Re: I think I'm starting to get it by tye
in thread I think I'm starting to get it by coolmichael

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.