in reply to
Beware of global variables, for they may prevent your destruction.
I ran into just about the exact same thing a couple weeks ago (in a FastCGI app, even) and dealt with it in a slightly more direct fashion:
our $foo_global = $foo;
While either way of handling this works, I prefer the undef
solution for a case like mine where the global data is only needed for one specific call, as it lets me immediately clean it up after that need passes. weaken
is definitely the better solution in other cases, though, where you may not know as clearly when you'll be done with the global.