If you look into the optree you'll see a list assignment aassign * happening in the second example instead of an scalar assignment sassign
C:\Windows\system32>perl -MO=Concise -E"substr(( substr( $p, 0, 1 ) = + '123' ), 0, 1 ) = 'x';" d <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 47 -e:1) v:%,{,469764096 ->3 - <1> ex-sassign vKS/2 ->d c <@> substr[t5] vKS/REPL1ST,3 ->- - <0> ex-pushmark s ->4 3 <$> const[PV "x"] s ->4 9 <2> sassign sKPRMS*/2 ->a 4 <$> const[PV "123"] s ->5 8 <@> substr[t3] sKRM*/3 ->9 - <0> ex-pushmark s ->5 - <1> ex-rv2sv sKRM*/1 ->6 5 <#> gvsv[*p] s ->6 6 <$> const[IV 0] s ->7 7 <$> const[IV 1] s ->8 a <$> const[IV 0] s ->b b <$> const[IV 1] s ->c -e syntax OK C:\Windows\system32>perl -MO=Concise -E"substr((( substr $q, 0, 1 ) = + '123' ), 0, 1 ) = 'x'" f <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 47 -e:1) v:%,{,469764096 ->3 - <1> ex-sassign vKS/2 ->f e <@> substr[t6] vKS/REPL1ST,3 ->- - <0> ex-pushmark s ->4 3 <$> const[PV "x"] s ->4 b <2> aassign[t4] sKPRMS* ->c - <1> ex-list lK ->6 4 <0> pushmark s ->5 5 <$> const[PV "123"] s ->6 - <1> ex-list lK ->b 6 <0> pushmark s ->7 a <@> substr[t3] sKPRM*/3 ->b - <0> ex-pushmark s ->7 - <1> ex-rv2sv sKRM*/1 ->8 7 <#> gvsv[*q] s ->8 8 <$> const[IV 0] s ->9 9 <$> const[IV 1] s ->a c <$> const[IV 0] s ->d d <$> const[IV 1] s ->e -e syntax OK

edit

see ikegami's answer here Re: Why Perl gets confused here?

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

*) aassign for "array" assignment is one of these misnomers like wantarray , should rather be named lassign


In reply to Re: Why Perl gets confused here? by LanX
in thread Why Perl gets confused here? by vr

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.