Yes, interpolation means double quoted string, regex metacharacters are still regex metacharacters m/.$/ and m'.$' match the same string
$ perl -Mre=debug -e " $_ = 1234; m/.$/ " Compiling REx ".$" Final program: 1: REG_ANY (2) 2: EOL (3) 3: END (0) anchored ""$ at 1 minlen 1 Matching REx ".$" against "1234" 3 <123> <4> | 1:REG_ANY(2) 4 <1234> <> | 2:EOL(3) 4 <1234> <> | 3:END(0) Match successful! Freeing REx: ".$" $ perl -Mre=debug -e " $_ = 1234; m'.$' " Compiling REx ".$" Final program: 1: REG_ANY (2) 2: EOL (3) 3: END (0) anchored ""$ at 1 minlen 1 Matching REx ".$" against "1234" 3 <123> <4> | 1:REG_ANY(2) 4 <1234> <> | 2:EOL(3) 4 <1234> <> | 3:END(0) Match successful! Freeing REx: ".$"

variables interpolate in double quoted strings but metachars are still metachars

$ perl -Mre=debug -e " $x = q{\d}; $f = 1234; $f =~ q{$x} " Compiling REx "$x" Final program: 1: EOL (2) 2: EXACT <x> (4) 4: END (0) anchored "x" at 0 (checking anchored) minlen 1 Guessing start of match in sv for REx "$x" against "1234" Did not find anchored substr "x"... Match rejected by optimizer Freeing REx: "$x" $ perl -Mre=debug -e " $x = q{\d}; $f = 1234; $f =~ qq{$x} " Compiling REx "\d" Final program: 1: DIGIT (2) 2: END (0) stclass DIGIT minlen 1 Matching REx "\d" against "1234" Matching stclass DIGIT against "1234" (4 bytes) 0 <> <1234> | 1:DIGIT(2) 1 <1> <234> | 2:END(0) Match successful! Freeing REx: "\d" $ perl -Mre=debug -e " $x = q{\d}; $f = 1234; $f =~ qq{\$x} " Compiling REx "$x" Final program: 1: EOL (2) 2: EXACT <x> (4) 4: END (0) anchored "x" at 0 (checking anchored) minlen 1 Guessing start of match in sv for REx "$x" against "1234" Did not find anchored substr "x"... Match rejected by optimizer Freeing REx: "$x" $ perl -Mre=debug -e " $x = q{\d}; $f = 1234; $f =~ q{\$x} " Compiling REx "\$x" Final program: 1: EXACT <$x> (3) 3: END (0) anchored "$x" at 0 (checking anchored isall) minlen 2 Guessing start of match in sv for REx "\$x" against "1234" Did not find anchored substr "$x"... Match rejected by optimizer Freeing REx: "\$x"

In reply to Re^5: Misreading m// documentation (BUG?) by Anonymous Monk
in thread Misreading m// documentation by QM

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.