http://qs1969.pair.com?node_id=25646


in reply to undefs and functions

I dont think there is an 'elegant' way to test each hash key in a nested hash. You could always come up with some funky loop and run exists on for each level. (my opinion would be that Russ's code is not 'elegant', however it is a solution, but there are probably dozens of solutions.)

Given that, why do you even want to test each key value? Perl should not really care if it exists or not. Are you trying to prevent warnings that might be occuring, or do you not want the hash keys to be autovivified? The answer to this might help guide us in the right direction. But if you dont care about autovivification or 'Use of uninitialized value in ...' warnings I would say to not worry about the tests. They will only slow things down.