in reply to Basic Print statement question
For variables of the same name, whichever was most recently declared in the lexical scope will be what's used, whether by print or anything else, when you just say $variable. (Where "declared" means via "my", "state", or "our".)
You can explicitly get a package variable by qualifying with the package name it was declared in, where the default package is "main" (with the empty string as an alias). So $main::var (aka $::var) will get the package variable, even if $var is a lexical at that point in your code.
I hope this helps you at least enough to rephrase your question.
|
|---|