At first, please take a look at the piece of code:
A test run:
What I expected:
Question: Why is the output different from what I expected? Is it a bug in Dumper()? Or my expectation is wrong?
Thanks.
Code:
#!/usr/bin/perl
use Data::Dumper;
my @a1 = ('a','b');
my %h1;
for(my $i = 0; $i <= $#a1; $i++) {
$h1{$i} = \@a1;
}
my @a = (\%h1);
print Dumper(\@a);
exit;
A test run:
Code:
% tt.pl
$VAR1 = [
{
'1' => [
'a',
'b'
],
[b]'0' => $VAR1->[0]{'1'}[/b]
}
];
What I expected:
Code:
$VAR1 = [
{
'1' => [
'a',
'b'
],
'0' => [
'a',
'b'
]
}
];
Question: Why is the output different from what I expected? Is it a bug in Dumper()? Or my expectation is wrong?
Thanks.