Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Tied multidimensional hashes

by xdg (Monsignor)
on Oct 13, 2006 at 12:42 UTC ( [id://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.

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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-03-19 14:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found