绘出数据结构图
Data::Dumper
参考:
安装
$ cpan ... cpan> install Data::TreeDumper ...
简单使用
比如我们有一个叫 %repo 的 hash,其引用就是 "\%repo":
use Data::Dumper; print Dumper(\%repo);
这样就可以输出 %repo 的数据结构图了。
再一例子:
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
my $a = "good";
my $b = "bad";
my @my_array = ("hello", "world", "123", 4.5);
my %some_hash = ("foo", 35, "bar", 12.4, 2.5, "hello",
"wilma", 1.72e30, "betty", "bye\n");
##使用函数
print Dumper($a);
print Dumper(\@my_array);
print Dumper(\%some_hash);
print Dumper((\%some_hash, \@my_array));
