Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Taking into account operator precedence in your first example, the 1 is all that's in scalar context. There is nothing to present a list to the assignment operator at all, and each element item to the right of the assignment operator gets its context separately (two thirds of them getting void context).

Likewise taking into account operator precedence in your second example, only @y is in scalar context. The exception that an array in scalar context yields its length is in effect, and that's what $x gets assigned.

No lists are presented to the operators due to comma being lower in precedence than assignment. I don't see how one's thinking about lists even becomes involved with the thinking about the assignment unless someone doesn't know that the comma operator is lower precedence than assignment.

If someone doesn't understand operator precedence, they have bigger issues than just a mental model of lists.

BTW, I've never programmed more than a couple of dozen lines of Python, total. I also think candy-flavored unicorns sound delightful, if a bit dangerous to taste.

Now, if we were dealing with a concept of lazy vs. eager assignment operators or specific atom and list assignment operators (which would need different names and not both be simply '=') instead of context being determined by the left operand of the infix operator, then that'd be another story. That'd be a different language, too, though.

In reply to Re^5: If you believe in Lists in Scalar Context, Clap your Hands by mr_mischief
in thread If you believe in Lists in Scalar Context, Clap your Hands by gone2015

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others taking refuge in the Monastery: (3)
    As of 2018-05-21 01:12 GMT
    Find Nodes?
      Voting Booth?