SPUG: Open big files

Yitzchak Scott-Thoennes sthoenna at efn.org
Fri Jan 23 07:02:48 CST 2004

On Thu, Jan 22, 2004 at 09:12:09AM -0800, Luis Medrano <lmzaldivar at mac.com> wrote:
> List,
> I have a question I need to open a files between 5 and 35 megs and work with those files but my question is how can I open the files using the min amount of memory??..

Opening the files won't consume significant memory.  It's how you read
them that matters.

If they are text files and you only need to work with one line at a
time, just make sure you use a loop like:

while (<INFILE>) {
   # process line in $_

instead of

for (<INFILE>) {


@lines = <INFILE>

If these are binary files, or you need information from more than one
line at a time, you'll need to more fully describe what you are trying
to do in order to get more help.

More information about the spug-list mailing list