in reply to Re^2: Accessing main::Constant
in thread Accessing main::Constant
Firstly, the syntax would be $main::VAR
Secondly, the value of variables in main are not set until after the uses at the top of the code, so you would get undef. You could address that by setting the $VAR in a BEGIN block:
... BEGIN{ our $VAR = 'fred'; } use pg; ...
But the question is why would you want to do that?
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Accessing main::Constant
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 |
In Section
Seekers of Perl Wisdom