in reply to My code (I can't figure out how to implicitly recurse)
in thread How to tie multilevel (multidimensional) hash?

You have multiple hashes, so you need to tie all of them. I think that will work. You're just using autovivification to create them in the above script. Try something like this:
use lib qw( . ); use MultiHash; my %hash_a; my %hash_b; tie %hash_a, "MultiHash"; tie %hash_b, "MultiHash"; $hash{ x } = \%hash_b; $hash{ x }{ y } = 10; $hash{ x }{ y };

Replies are listed 'Best First'.
Re: Re: My code (I can't figure out how to implicitly recurse)
by mikezone (Novice) on Feb 12, 2003 at 03:26 UTC

    Thanks for taking the time to help me out, perrin, I feel like I'm getting closer and closer to the answer!

    Your code is close to what I'd like to do, but it'd be best if in the process of STORE()ing creates the node and then attempts to STORE the following dimension. That is, the statement $hash{ x }{ y } = 10; does all the nested ties, automatically. One of my requirements is that I don't know how many dimensions I may have to go, and I'd hate to manually tie() every time I add a key to a hash. I hope I'm doing more than autovivifying; I'm creating nodes and tie()ing them, as well as assigning them to the parent hash. If I could then have that node call STORE() and be able to give that STORE() meaningful parameters, I'd be done. But I can't figure out how to do that.