We don't bite newbies here... much | |
PerlMonks |
Re^10: If you believe in Lists in Scalar Context, Clap your Handsby mr_mischief (Monsignor) |
on Oct 28, 2008 at 14:11 UTC ( [id://720008]=note: print w/replies, xml ) | Need Help?? |
No. Just, no.
People are saying there are only three little things to remember so their model is much simpler. The ideas that "list" is a "value", "assignment" is an "operation", and that a "list of scalars" in the syntax does not become a "list value" in the semantics are at least three more concepts to that abstraction. It's not a non-question, because I can answer how it happens: a list of scalars doesn't propagate its own value, and in an assignment is processed by the assignment operator which in a scalar context returns the last value in the list. This last value is typically the last value returned by the comma operator. Without the additional concepts of "list of scalars" vs. just "list", "list value" vs. just "list", the idea that the syntactic "list of scalars" is not what propagates the value, that the assignment operator does, and just what the comma operator is doing (or that it is an operator at all and not just part of a "list syntax"), the simple "three" rule explanation doesn't explain anything to the uninitiated.
In Section
Meditations
|
|