Yep Data::Dumper is a good library (thanks) :)
But you can also use Data::Printer which can colored chars, limit the depth levels, set the indent size, multilines...
There are a lot of options.
https://metacpan.org/pod/Data::Printer
Use p instead of print/say.
p $href;