http://www.perlmonks.org?node_id=578125


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.

Replies are listed 'Best First'.
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