http://qs321.pair.com?node_id=580490


in reply to seeking in hash data structure

There's a fairly simple algorithm to do this that you can write if you understand how recursion and references work. Your function starts with a reference to the root of the hash, the value to add once you find the right node, and a list of keys to find that node. Shift the first keys from the list and look up that entry in the hash, which gives you a hashref. Call the function again recursively with this new hashref, the same value to add, and the remaining keys. Once there are no more keys, you can add the value to the hashref you have, which will point to the right position in the tree. Use a syntax like $hashref = $hashref->{key} to go down to the next level in the hash. By "non strict references" I assume you meant symbolic references, the ones you can't use with use strict. And no, those won't work, because the hashes are anonymous.