The list was things that make lists, which are the problematic things Scalar/List context-wise. At that point I was summarising what had been discussed so far...
But you had discussed arrays and hashes. Are you implying that array slice make lists and arrays don't?
The omission seems rather "convenient" because it allowed you to cut two exceptions from the "in Scalar Context" list.
Given that an array returns a list in list context, how do you place that list in scalar context?
I would argue that, when treated as an rvalue, this is the key difference between a list and an array. Since in Scalar Context the value of the array isn't the list, the case does not arise.
Exactly. A list can't be produced in scalar context. So how can a list be put into scalar context?
The point of the question was to point out that "list" is an overloaded term. "List in scalar context" is deceptive, misleading and/or confusing.
Ah. I had expected the second, scalar assignment, to operate on the result of the first assigment.
Assignment operators are right-associative. That means that in chain of assignments, the right-most has highest precedence. ** is also right-associative.
>perl -le"print( 2**3**4 )"
>perl -le"print( (2**3)**4 )"
>perl -le"print( 2**(3**4) )"
OK. Well, everybody avoided mentioning the influence of Scalar Context on arrays.
Two of the three types of list I mentioned in my answer can't be put into scalar context. That makes it a rather minor difference.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
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:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- 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
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||