in reply to Is this a reasonable data structure?

What you are probably going to want is a hash of hashes, as long as you can count on the values for your top level of hash being unique, and especially if the values in the top level hash being something you will frequently use for lookups.

In a hash of hashes you'd load and access your data in a pattern similar to:

$person->{'caralo_l'}{'title'} = "Mrs"; $person->{'androno_j'}{'room'} = "317"; $person->{'paterman_s'}{'last'} = "Paterman"; $person->{'paterman_s'}{'email'} = "stv@net.net";

The main downside to an array of hashes is that it (the array) will have to be traversed to find specific entries in the hashes. Of course, the top-level hash in a hash of hashes will have to be traversed if the keys aren't being helpful.

Check out Randall Schwartz's 'Learning Perl Objects, References and Modules' if you haven't done so for it's very lucid discussions of references and data structures.

Replies are listed 'Best First'.
Re: Re: Is this a reasonable data structure?
by eric256 (Parson) on Oct 23, 2003 at 21:09 UTC

    If you are going for speed of retrieval, then you could do an LoL and then have a hashtable to lookup indexes. Then you could have hashes that are keyed on firstname, lastname, a combination, or anything else. This can be a rather phone problem. The sick reason i enjoyed the data structures class :-)


    ___________
    Eric Hodges