in reply to Re: Accessing main::Constant
in thread Accessing main::Constant
Thanks.
It works fine.
I need another clarification, Is it possible to access a variable in main package like below,
package pq; . use constant { VAR => "main::$VAR" }; . . sub pr { print main::$VAR; print VAR; }
I'm getting error. So I thought, 'As the constants are expanded when compilation, it isn't working as what I expected'. $VAR is a our variable in main package.
In Section
Seekers of Perl Wisdom