in reply to Memory Leak

As long as you make sure you have closures for your variables it won't be a problem. Create as few global variables as possible, use "my $variable" and use strict;.

The suggestions above are all good as well.