in reply to Using hashref values in constant declarations.
my @test = ($hashref->{ONE} .. $hashref->{TWO}); use constant GOODCONSTANT => \@test;
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
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
|
---|