in reply to Running out of resources while data munging

I think you are only showing us part of the program and have left out the most important part: how does your procesfile subroutine tells the calling part what is in %hash? Do you perchance return a reference to %hash? That would account for the increase in memory.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James