in reply to Re^4: A curious case of of my() (What is GLOBAL?)
in thread A curious case of of my()

hmmm - but separating the my from the if turns on the lexical scope whereas leaving it as is keeps that turned off when tested.

One world, one people

Replies are listed 'Best First'.
Re^6: A curious case of of my()
by LanX (Saint) on Apr 05, 2011 at 12:48 UTC
    Scope is another often misunderstood concept.

    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

Re^6: A curious case of of my()
by JavaFan (Canon) on Apr 05, 2011 at 12:43 UTC
    Can you either shut up, or actually post some code that shows the variable isn't bounded by a lexical scope?

    You keep babbling on that the variable isn't lexical, but remain utterly silent when queried for some actual proof.

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re^6: A curious case of of my()
by LanX (Saint) on Apr 05, 2011 at 12:49 UTC