Your explaination/lack of code example is rather vague. It sounds as if you are probably pulling a very large query into an array and/or looping over it in a while loop. If the data set is really large you are going to run out of memory. Therefore you may need to refine your query to a stricter criteria and then run that multiple times so you can digest it in smaller chunks.
Thanks THRAK. Sorry about the lack of code example. I'm doing what you suspect -> looping over a fetch from the statement handle and putting the data in a hash array. I had a feeling I might have to break this up into smaller queries.
Big queries are fine.
However, if you're doing this, check out perltie.
This should cure many evils associated with hash sizes taking you out of memory.