XP is just a number | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
a reccuring problem for me seems to be a way to acquire a reference to an arbritrary point in a data structure comprised of nested hashes.
suppose for example you have: or something similar, now with this hash you could create a subroutine for each level of the data structure, say "sub add_company" or "sub add_application" but ideally what id like to be able to do is to seek to any level of the data structure and just throw in a value to do that I suppose what you'd need to do is create a sub which takes a set of names to "crawl" along in the hash data structure, this would then find a reference to the part of the data structure you want, and then perform a set of operations to the 'location' referred to, independent of where that is. with this you could then say something like: perhaps the above example could be perfomred using hash::merge, but still having an ability to find an arbitrary point in a data structure that can be then passed to a function would be immensely helpful, and if it seems like i'm trying to use hash structures like file hierachies, well yes, that's exactly right the question i ask is, how to do it, I've tried using recursive hash references like \$hashref = $%hashref{foobar}and perl seems to really not like that, same with trying to construct the name of the hash from the root of the structure via non strict references what am I missing?, any syntatic sugar, or a modules that I really should get to grips with In reply to seeking in hash data structure by Maze
|
|