in reply to What is it I don't understand about perl scoping?

foo doesn't see the $foo you are assigning 1 to. It sees the $foo you are assigning 2 to, but at that time, it's still uninitialized.

my always creates a new variable. The creation of the variable is done at compile time (and hence, at that time it's "decided" which variable a line of code "sees"); the initialization is done run time.