Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Tied multidimensional hashes

by xdg (Monsignor)
on Oct 13, 2006 at 12:42 UTC ( #578125=note: print w/ replies, xml ) Need Help??


in reply to Tied multidimensional hashes

Unless your goal is to practice reimplementing multi-dimensional tied hashes, I'd try one of the existing modules on CPAN instead. The "classic" is MLDBM. But dragonchild has done some tremendous work on DBM::Deep and I'd suggest trying that one first.

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.


Comment on Re: Tied multidimensional hashes
Re^2: Tied multidimensional hashes
by Limbic~Region (Chancellor) on Oct 13, 2006 at 13:52 UTC
    xdg,
    I am afraid I have no idea how either of the modules you suggested would come close to accomplishing what davis is wanting to do.
    tie my %flat, "FlatHash"; $flat{Monkey}{habits} = "Eating"; $flat{monkey}{habits} = "Scratching"; warn Dumper(\%flat); __END__ Ultimately I'd like the final datastructure to be something like: $VAR1 = { 'monkey' => { 'habits' => ['Eating', 'Scratching'] } };

    To me it sounds like a variation on Data::MultiValuedHash or less likely Hash::MultiKey except that the top level is also case insensitive.

    Cheers - L~R

      I am afraid I have no idea how either of the modules you suggested would come close to accomplishing what davis is wanting to do.

      Perhaps something in DBM::Deep using filter_(fetch|store)_(key|value) would work. Severly untested, and I see the smoke from dragons rising through the fog, but I think it would be possible.

      --MidLifeXis

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://578125]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2014-12-27 13:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls