in reply to Doubly-nested deeply bound variable is undefined

My best guess is that perl thinks that $x is not used within foo(), so it doesn't bother to keep track of it -- unless you reference $x directly within foo(). Maybe it doesn't look into the inner sub or something.

That's exactly it. It's probably done as an optimization. If foo doesn't use $x, it's not available to child functions either.

Yeah, it should give a strict error.