[Israel.pm] Memory problem - Loading big files

Shmuel Fomberg semuelf at 012.net.il
Thu Jun 19 12:44:12 PDT 2008


Assaf Gordon wrote:

> I'm having problems loading big files into memory - maybe you could help
> me solve them.
> 
> My data file is a big (~250MB) text file, with eight tab-separated
> fields. I want to load the entire file into a list.

Another idea: instead of loading the entire file, you can load "only" 
the list of file positions for every line. (using tell()) and when you 
search the file, you just seek to the location (seek()), read the line, 
and be off with it.

Shmuel.



More information about the Perl mailing list