in reply to Re: Doubly-nested deeply bound variable is undefined
in thread Doubly-nested deeply bound variable is undefined

Exactly. I guess my question is, why doesn't the use of $x inside the anonymous sub tell foo() that it needs to close over $x? Is this a bug in the perl interpreter?

And by the way, thanks for all the answers everyone. I have the feeling that there's really no satisfying way to solve this at this time :) The workarounds are helpful, though.

  • Comment on Re^2: Doubly-nested deeply bound variable is undefined

Replies are listed 'Best First'.
Re^3: Doubly-nested deeply bound variable is undefined
by chromatic (Archbishop) on Nov 14, 2006 at 19:35 UTC

    Yes, it's a bug in Perl 5.8. Dave Mitchell fixed it in bleadperl, so the code works correctly in Perl 5.9.3 and later (maybe 5.9.2).

      Awesome, now I can sleep at night. Thanks :)