Data::Dumper 似乎没有扩展作为哈希键的引用,我无法弄清楚要更改哪些设置才能这样做。这甚至可能吗?
示例代码:
#!/usr/bin/perl
use Data::Dumper;
@array = ('foo', 'bar');
$arf = \@array;
%hash1 = ( 'baz' => $arf );
%hash2 = ( $arf => 'baz' );
print Dumper(@array); print "\n";
print Dumper(%hash1); print "\n";
print Dumper(%hash2);
这输出:
$VAR1 = 'foo';
$VAR2 = 'bar';
$VAR1 = 'baz';
$VAR2 = [
'foo',
'bar'
];
$VAR1 = 'ARRAY(0x8be1b04)';
$VAR2 = 'baz';
但我想要一些东西来获得输出:
$VAR1 = 'foo';
$VAR2 = 'bar';
$VAR1 = 'baz';
$VAR2 = [
'foo',
'bar'
];
$VAR1 = [
'foo',
'bar'
];
$VAR2 = 'baz';