in reply to Data::Dumper in perl-only?

If you have access to a copy of Advanced Perl Programming, by Sriram Srinivasan, you will probably find the pretty-printing example near the end of the second chapter useful; it does pretty much exactly what you want.

--
:wq