in reply to Memory use when reading a text file

You are using <INP> in list context. That will make Perl slurp in the entire file, and turn it into a list of lines.

The standard idiom of processing a file line by line is:

while (<IN>) { # Processing goes here; the current line is in $_ }
That should cut your memory usage as it doesn't read in the entire file in memory (unless there's just one line in the file...)

Abigail