On Wed, 2007-02-14 at 12:37 +0100, Arantxa Otegi wrote:
> I have memory problems programming with perl: "out of memory!"
> 
> I have to process a lot of xml files which are in different directories 
> (more than 20000 files in 110 directories). The files are quite small 
> (almost all of them are smaller than 100KB).

> opendir(DIR,$sarrera_dir)|| die "ezin da ireki DIR: $sarrera_dir";
> @dirs = readdir(DIR);
> closedir(DIR);
> 
> foreach $dir (@dirs){

opendir(DIR,$sarrera_dir)|| die "ezin da ireki DIR: $sarrera_dir";
while( $dir = readdir(DIR) ){
}
closedir(DIR);

It should be obvious why this is taking less memory.

-- 
Ken Foskey
FOSS developer


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to