是什么 ? | : | stringified perl data structures, suitable for both printing and eval. |
开发语言 | : | Perl |
metacpan | : | https://metacpan.org/pod/Data::Dumper |
操作系统 | 包管理器 | 安装命令 |
---|---|---|
All | cpan | cpan -i Data::Dumper |
All | cpanm | cpanm Data::Dumper |
CentOS | yum | sudo yum install -y perl-Data-Dumper |
dnf | sudo dnf install -y perl-Data-Dumper | |
openSUSE | zypper | sudo zypper install -y perl-Data-Dumper |
创建Data::Dumper
实例。
示例:
my $baseInfo = {name => "fpliu", age => 20, height => 180.5};
my $saySomthing = [{dateTime => "2020/02/05 15:30:00", text => "I Love you!"}];
use Data::Dumper;
my $dumper = Data::Dumper -> new([$baseInfo, $saySomthing], ["baseInfo", "saySomthing"]);
得到格式化化的字符串。
示例:
my $str = $dumper -> Dump();
print $str;