in reply to Re: Re: Unexpected variable assignment
in thread Unexpected variable assignment
Think about it this way - a list is some stuff collected together, but an array is a place in memory with all sorts of magic associated with it. This means that you can take an array and do useful operations on it, but you cannot do that with a list. However, there is no such thing as "array context" - it's "list context".
The reason why most people confuse the two (and why they're usually interchangeable) is that an array will (usually) impose list context around it, if it's an lvalue. (Also, there's the deplorably-named wantarray, which actually checks for list context and has nothing to do with arrays.)
At this point, you've exhausted my knowledge. If you want more, I suggest reading the relevant portions of the Camel book. I did so at one point, thought it was neat, then promptly forgot it cause it's never once been relevant to me in my years of Perl development. :-)
------
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
|
|---|