Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Building dynamic nested hash references

by ryan (Pilgrim)
on Jan 21, 2004 at 12:05 UTC ( #322849=note: print w/ replies, xml ) Need Help??


in reply to Building dynamic nested hash references

Thanks ysth and broquaint, that does it nicely.

Now I know this follow-on question is really asking for another data structure like a linked list, but ...

... assuming I had the same information but wanted to step my way back *up* the 'tree' to find the parent hash of the item we found in this example, and then the parent of that etc, is there any way to do this on the hash I've displayed? The only way I can think of is to store references to each of the steps taken down the tree (when the item was initially found) in an array and query that?

Update: or storing parent hash information in the tree itself as it is built?

I really want a different data structure don't I? :)

Ryan


Comment on Re: Building dynamic nested hash references
Re: Re: Building dynamic nested hash references
by Roy Johnson (Monsignor) on Jan 21, 2004 at 15:49 UTC
    Like the actual filesystem, you should store a ".." entry in each directory when you create it.

    The PerlMonk tr/// Advocate

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2014-09-24 01:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (244 votes), past polls