|Pathologically Eclectic Rubbish Lister|
Re^4: Conditional array initialisation? (Question expanded)by BrowserUk (Pope)
|on Jul 12, 2013 at 21:24 UTC||Need Help??|
Nevertheless undef @a is allowed, adding even more confusion:
I don't see any confusion nor potential for it.
If I have a scalar and at some point in my code I wish to check if it currently has a value, and if it does not, set it, I might write:
More recently, I'd write that as: $x //= getValue();. Clear concise semantics.
If have an array, and at some point in my code I want to check if it contains anything, and populate it if it does not, I might write:
Thus using the value of the array in a scalar context to decide if the array is empty or not.
It seems a natural, semantically clear, easily implemented extension of the scalar case above to write that as:
Test the scalar context value of the array, and if it is false, assign the list on the right hand side to the array on the left.
Indeed, it seemed so logically analogous, and semantically clear, that I wrote it and expected it to work, and I was taken by considerable surprise that it didn't.
Hence my OP.
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
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.