in reply to Code stalls...possible memory leak?

Instead of slurping the entire file into a scalar all at once, try line processing using 'while'. This will take far less memory.
open INFILE, "<$infile"; while ($line_in_file = <INFILE>) { do processing here... } close INFILE;

--
Filmo the Klown