in reply to Re: Re: hash on memory or disk?
in thread hash on memory or disk?

No, keys in scalar context just returns the number of elements of the hash; and the hash keeps score in its internal datastructure.

This is of course assuming we are talking about a normal hash. If the hash is tied, then it will depend on the implementation.

Abigail

Replies are listed 'Best First'.
Re: hash on memory or disk?
by js1 (Monk) on Jan 14, 2004 at 15:26 UTC

    Thanks for your reply.

    I have managed to reduce some of the memory usage (because I'm able to process more of the log now) but my program is still crashing. I'm having a problem tying the hashes whose elements are arrays e.g.

    tie %recipientqids, 'MLDBM', "/home/u752359/recipientqids.db", O_CREAT +|O_RDWR, 0640 or die $!; push(@{$recipientqids{$hostqid}},$recipient); .. .. foreach $hostqid( @{$msgidqids{$msgid}}){ foreach $recipient (@{$recipientqids{$hostqid}}){ print STDERR "\nrecip= $recipient"; } }

    doesn't print anything if I tie the recipientqids hash.

    Is my syntax wrong, or can you not store these structures with MLDBM?

    Thanks,

    js1