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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Accessing main::Constant
by BrowserUk (Patriarch) on Dec 16, 2009 at 06:07 UTC | |
by Anonymous Monk on Dec 17, 2009 at 08:01 UTC | |
by desemondo (Hermit) on Dec 17, 2009 at 08:49 UTC | |
by BrowserUk (Patriarch) on Dec 17, 2009 at 19:44 UTC | |
Re^3: Accessing main::Constant
by ikegami (Patriarch) on Dec 17, 2009 at 16:03 UTC |
In Section
Seekers of Perl Wisdom