in reply to Re^5: A curious case of of my()
in thread A curious case of of my()
For instance my, our and package follow the same scope rules (block or file scope).
The scope decides which declaration is used at compile time too chose a "memory slot" for an (unqualified) variable. And the effect is hardcoded into the compiled opcodes!
(i.e. either a hash-lookup in a "symbol table" of a package or "variable pad" of the surrounding lexical blocks)
You're identifying scope with initialization, but the latter is a run time issue, which is disabled in an if-clause.
Other languages like JS or Python follow more static mechanisms, leading to other quirks.
Cheers Rolf
|
|---|