in reply to walking a hash

I have tried a number of recursive solutions

That's definitely the way to go. Dumping a node involves

To be able to print the node's name, you need the name of its ancestors. You can simply pass them as arguments.