I don't find the relevant discussions and bug reports, but this feels similar to nested anonymous subroutines closing over variables. You have two nested anonymous subroutines, and the outer subroutine does not mention $x. Ideally, a workaround fix would be to just mention $x in the outer subroutine too, but that does not change the issue.
I'm sorry that I can't find the relevant links and discussions...
Potentially see also nested subs cause DESTROY block to not get hit and search for "nested subs" (but ignore all the problems with named nested subroutines).
In reply to Re: Reference to guard not released
by Corion
in thread Reference to guard not released
by roman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |