|No such thing as a small change|
Ref to a list not being equivalent to a list of refs to each elementby Hue-Bond (Priest)
|on Jun 22, 2006 at 15:37 UTC||Need Help??|
Hue-Bond has asked for the wisdom of the Perl Monks concerning the following question:
(This is not an XY problem, nor something that will go to production; just a question that arose while I was playing with obfuscated code).
Let's declare a constant:
That's expected behaviour. Now, a little twisted:
Surprise! What's that? Isn't it a constant anymore? Isn't that reference to a list, a list of references to each element? Well, let's make an explicit list of references then:
This is expected again. But, why does the second snippet behave different?