[kw-pm] a philosophical question about hashes

Robert P. J. Day rpjday at mindspring.com
Wed Jun 15 16:30:05 PDT 2005

On Wed, 15 Jun 2005, Christopher Calzonetti wrote:

> 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.

i'd thought of that as well.  i *can* see the value in the
duplication, i was just wondering if anyone had strong opinions on
this either way.


More information about the kw-pm mailing list