|go ahead... be a heretic|
Re: Re: dot '.', comma ',' operators "oops" & "huh?"by davido (Archbishop)
|on Aug 22, 2003 at 16:58 UTC||Need Help??|
The comma is still constructing a list, that simply has nowhere to go. Since the list is constructed left to right, the right-most element ends up being assigned to $a.
It would appear that I'm incorrect in asserting that the thing on the right side of an equation that looks like this:
could be construed as being a list. And even more incorrect in saying that it is in scalar context.
While I don't understand how it isn't a list (it's contained in (), it has commas, and it represents multiple values), I do understand that whatever term we can use to describe the Rvalue entity, we cannot say that it is a list in scalar context. This, to my understanding after reading merlyn's discussion threads is because a list is a list is a list, and scalars are scalars are scalars. The only possibly accurate description for the above code example, that I can come up with having read merlyn's words, are that it is the list is passing its rightmost element through the assignment operator ( = ) which is, itself, in scalar context. The entity on the right still looks like a list to me, but it is apparently accurate to assert that the comma operator knows whether the items it is affecting are being passed to a scalar or to an array. My prior supposition was that the assignment operator ( = ) was the one who understood things like context.
I am nevertheless curious to see the internal representation of a statement such as the one above; not the 'perl -MO=Deparse' one, but still lower level, so that I can better understand the nature of such a statement. I can accept at face value the descriptions I've received from the Gods and Saints, but it is still appropriate to understand the internal character of ones' faith.
"If I had my life to do over again, I'd be a plumber." -- Albert Einstein