in reply to Memory Leak

Well, this will leak:
sub leaky { my %hash; $hash{'fred'} = 'flintstone'; $hash{'me'} = \%hash; } leaky(sleep 1) while 1;
It leaks because it has a mutually-referencing data structure. Reference-counting cleanup can't fix this, any more than it can do it in C++. {grin} You need a mark/sweep garbage collection to catch this, and some version of that is proposed for Perl 6, but probably won't ever be retrofitted into Perl 5.

The solution for now is "don't do that". Use weak references if you've got them. Otherwise, be sure you break the cycle somewhere before you exit the scope.

-- Randal L. Schwartz, Perl hacker