ts: multiple keys for same value? 
Author Message
 ts: multiple keys for same value?

Is it possible in a DBM file to have more than one key per
value? Suppose you want to be able to key off of SSN or
driver's license number. Right now I have something like:
   $h{"D4902432"} = "222-22-2222";
   $h{"222-22-2222"} = "Simpson, Orenthal";

but this approach requires two lookups if the DL number is
used instead of the SSN:

   $id = $h{$id} if $id =~ /^D/;
   $name = $h{$id};

Does anyone have any better ideas? Is it possible to use
references in a DBM?
--ts

  --------------------------------------------------------------------
  Posted using Reference.COM                   http://www.*-*-*.com/
  FREE Usenet and Mailing list archive, directory and clipping service
  --------------------------------------------------------------------



Sat, 12 Aug 2000 03:00:00 GMT  
 ts: multiple keys for same value?

: Is it possible in a DBM file to have more than one key per
: value?
        Huh?  And point to the same value, no.

: Does anyone have any better ideas?

        Maybe.

: Is it possible to use references in a DBM?

        No.  At least, not hard references.  You can of course hold
        string values that can be keys for other info or other DBMs
        though.

        Also check out the MLDBM module.

--
-Zenin



Sun, 13 Aug 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. hash with multiple values for 1 key

2. multiple keys with same value in declaration?

3. Multiple values per key

4. ts: ts: Remove files in a PERL sript

5. ts: ts: how to parse embedded commas

6. registry: can create key value but not key.

7. Calling function with hash values as key-value arguments

8. splitting array, each element holding multiple values into array with single values

9. Multiple keys in DBM

10. How to reference multiple keys from a hashref?

11. Hashes with multiple keys?

 

 
Powered by phpBB® Forum Software