Data::Traverse exports a single function, traverse, which takes a BLOCK and a reference to a data structure containing arrays or hashes. Objects are treated as normal references (e.g. a blessed hash will be traversed the same way as an unblessed one.) Only arrays and hashes are traversed; if an unsupported reference type is found (such as a glob or regex), Data::Traverse will croak with an error. Alternatively, you can make Data::Traverse ignore unsupported reference types by doing:

Data::Traverse performs a depth-first traversal of the structure and calls the code in the BLOCK for each scalar it finds. $_ is set to the type of the container ('ARRAY' or 'HASH'). For arrays, the magic variable $a contains the data. For hashes, the magic variables $a and $b contain the key and the value, respectively.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.