in reply to Out of memory

The first thing you should do is read the section on this in the Camel Book (Programming Perl).