> If "'" is the delimiter, no interpolation is performed on the PATTERN.

hmm, strange in 5.10 this uncommon feature seems to be buggy:

$ perl if ( '_$x_' =~ '$x') { print "match 1" } if ( '_$x_' =~ /\$x/){ print "match 2" } __DATA__ match 2

while B::Deparse claims both lines to be identical ...

perl -MO=Deparse if ( '_$x_' =~ '$x') { print "match 1" } if ( '_$x_' =~ /\$x/){ print "match 2" } __DATA__ if ('_$x_' =~ /\$x/) { print 'match 1'; } if ('_$x_' =~ /\$x/) { print 'match 2'; } __DATA__ - syntax OK

... does B::Concise show that the interpolation is not inhibited

perl -MO=Concise if ( '_$x_' =~ '$x') { print "match 1" } if ( '_$x_' =~ /\$x/){ print "match 2" } __DATA__ g <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 3 -:1) v:{ ->3 - <1> null vKP/1 ->9 5 <|> and(other->6) vK/1 ->9 4 </> match(/"$x"/) sKS/RTIME ->5 <-- INTERPOLA +TED 3 <$> const[PV "_$x_"] s ->4 - <@> scope vK ->- - <0> ex-nextstate v ->6 8 <@> print vK ->9 6 <0> pushmark s ->7 7 <$> const[PV "match 1"] s ->8 9 <;> nextstate(main 5 -:2) v:{ ->a - <1> null vKP/1 ->g c <|> and(other->d) vK/1 ->g b </> match(/"\\$x"/) sKS/RTIME ->c <-- NO INTERP +OLATION a <$> const[PV "_$x_"] s ->b - <@> scope vK ->- - <0> ex-nextstate v ->d f <@> print vK ->g d <0> pushmark s ->e e <$> const[PV "match 2"] s ->f - syntax OK

added marks to highlight differences.

Can someone please check for other perl versions?

Cheers Rolf

( addicted to the Perl Programming Language)


In reply to Re^2: Misreading m// documentation (BUG?) by LanX
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.