in reply to High memory consumption problem

See Tutorials: Variable Scoping in Perl: the basics, Coping with Scoping

Mini-Tutorial: Perl's Memory Management

Memory leaks and circular references, Circular references and Garbage collection., make perl release memory