in reply to Traverse an unknown multi-dimensional hash
How would you traverse this hash to print out all key => value pairs. The only way I know how is a series of for loops, however that would mean you have to know in advance how deep it goes.If printing is all you want, use Data::Dumper or one of its kind as suggested - if you want to code the stuff yourself (anybody smelling homework here?), or have really completly different needs than printing, then have a look at ref, which you can use to determin the datatype of the inspected value, and thus to decide what action to take (recurse into another hash, recurse into array, print a scalar, ...). A recursive implementation will be easiest to implement - however if the structures you expect are deeply nested, I'd use a stack to implement an iterative solution.
An intellectual is someone whose mind watches itself.
-- Albert Camus