$ perl if ( '_$x_' =~ '$x') { print "match 1" } if ( '_$x_' =~ /\$x/){ print "match 2" } __DATA__ match 2 #### 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 #### 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 <-- INTERPOLATED 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 INTERPOLATION 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