in reply to Array of Hash interface to an Array of Array?

It sounds like you think you want a pseudohash. However, from the perlref manpage ...
"WARNING: This section describes an experimental feature. Details may change without notice in future versions."
They are deprecated, I believe, in perl 5.8 and will be removed in 5.10. IOW, you really don't want to use 'em. The fields pragma is the new implementation which should be safe to use. Whether fields will help conserve memory or not I don't know.

However, you probably don't want to do that either. I think you should look at tie()ing the hash to a dbm file. I prefer using GDBM_File in most situations, but you should look at the handy comparison chart in the AnyDBM_File docs before choosing a dbm implementation.

In combination with MLDBM you should be able to work with your data, with a remarkably low memory requirement.

  • Comment on Re: Array of Hash interface to an Array of Array?

Replies are listed 'Best First'.
Re: Re: Array of Hash interface to an Array of Array?
by jaa (Friar) on Sep 01, 2003 at 16:41 UTC

    Thanks for the pointers...

    Pseudo-hashes only sound like half of what I want - is an array of 350,000 PHs really much more efficient than an array of 350,000 Hashes? Abigail alluded to more efficient use of memory arising from reducing the number of structures.

    I think that what I really want is a single something that stores data efficiently - eg an AofA or even an array of packed strings, or even a single huge string, or chunked pieces of string... possibly qubit encoded on chromium atoms for compactness...(slaps head twice, breathes deeply, zen-like calm returns...)

    ...that provides a transparent Array like interface for accesing collection elements and a Hash like interface to access properties of individual elements.... mmmm, Yet Another Database And Yes Another Database Approach (YADAYADA) is about to be born?... not 8-)

    I can see how tieing this into a flat-file db could further save memory, I already use Tie::File arrays to process incoming flat-files.

    scurries off to check it all out...

    Thanks again to all,

    Jeff