Perl-Sensitive Sunglasses | |
PerlMonks |
Re: Using hashref values in constant declarations.(binding)by LanX (Saint) |
on Sep 09, 2017 at 09:37 UTC ( [id://1199002]=note: print w/replies, xml ) | Need Help?? |
> However, why does this work as expected, then?
Short answer: that's how "binding" works! my (like our ) has dual nature:
Declaration means the following equally named variables in scope are "bound" to a specific "reference" (saying address would be too simplisti/C) when translated to an op tree. GOODCONSTANT then points to that reference at compile time, but the content of @test will only be populated at run time. Try to access content of GOODCONSTANT at compile time, and you will fail.
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|