1. Perl
  2. Module
  3. here

DDP - Output data in an easy - to - understand way

You can use a module called DDP to output data in an easy-to-understand way. Useful for viewing the contents of complex data with nested hashes and arrays.

# Output data in an easy-to-understand way
use DDP;
p $data;

Because DDP is included in the distribution Data::Printer. If you install Data::Printer, DDP will also be installed.

There is Data::Dumper as a core module as a tool for outputting Perl data. Data::Dumper is difficult to use in the following points. The first is that the string is output as an internal representation, so it is difficult to check what kind of string is included. The other is that data dumping is a popular feature, but typing is a bit long.

DDP has the following features.

  • You can display strings written in UTF-8
  • You can output the data with a function called p.

You can also write in one line by writing the following in the place where you want to output the data.

use DDP; p $data;

Related Informatrion