[kw-pm] a philosophical question about hashes

Christopher Calzonetti elbie at trig.net
Wed Jun 15 14:40:16 PDT 2005

On Wed, Jun 15, 2005 at 04:33:39PM -0400, Robert P. J. Day wrote:
>   not so much a perl question as a software design question that just
> happens to be associated with perl -- is it considered bad form to
> create a hash in which each element's key is also one of its fields in
> the corresponding value?
I can see at least one reason for doing this:

Say there are a bunch of different unique identifiers for a record, and you
point to a reference that contains the full record.

In your example, you might also have a hash based on driver's license
number, and you want to use the same records.  Well then, the record would
need the SSN/SIN, as it wouldn't be the index.
Christopher Calzonetti, Technical Lead, Trig.Net
   Web:  http://www.trig.net/     Mail:  mailto:chris at trig.net

More information about the kw-pm mailing list