![]() |
|
Pathologically Eclectic Rubbish Lister | |
PerlMonks |
comment on |
( #3333=superdoc: print w/replies, xml ) | Need Help?? |
because there is no such thing as a list in scalar context, My take on it is that this is the exception that disproves that rule. Whilst others will disagree and probably decline to comment. If you put that thing--two or more things separated by commas--that we're told is not a list, in a scalar context, at compile time, then the compiler knows the list is useless and can discard all but the last element. This is shown nicely by Deparse:
And backed up by warnings:
But construct that same thing in a way that the context is not directly discernable at compile-time, and it has no choice but to Again nicely shown by Deparse:
And no warnings either:
Just a what does \(LIST) become? The only way left to describe it is that the thing (that would be a list in a list context), becomes the last element of that thing when it finds itself in a scalar context. :) Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
In reply to Re^3: Why does foo() evaluate in array context in "${\foo()}"?
by BrowserUk
|
|