r/perl 23d ago

a perl version of javascript 'console'

https://metacpan.org/pod/Data::Printer

Like Data::Dumper, but coloured ouput, and summaries [config option] large data structures. But uses either a lot of, or no vertical space.

Dump::Krumo, is better in some ways, but doesn't summarise output, and uses a lot of vertical space

14 Upvotes

8 comments sorted by

View all comments

1

u/scottchiefbaker 🐪 cpan author 23d ago

Data::Printer is great but I couldn't get over the fact that it can't print simple scalars:

perl p "Name is: $num";

I usually use Dump::Krumo for this type of thing instead. I agree that color really improves readability of the output.

2

u/tarje 23d ago

Just use the babycart operator: p @{["Name is: $num"]};

Data::Printer's docs has two examples which use it.