In Perl debugger you can very nice output a hash like:
DB<1> x \%my_hash
How can I use the debugger output method 'x' in my programm to log pretty formated hash data in my logfile?
Use Data::Dumper
. It is a core module, so no installation required. It is a good debugging tool.
use Data::Dumper;
...
print Dumper \%my_hash;