in reply to Re: Doubly-nested deeply bound variable is undefined
in thread Doubly-nested deeply bound variable is undefined
Sounds right. I just don't understand why a print() statement makes perl change its mind and use the correct instance of $x. Actually, I've been playing around with it and it seems like any reference to $x inside foo() makes it work correctly, even if it's just
$x;
on a line by itself.