zengargoyle nailed your problem down, but I played around a bit to reproduce your problem and have some extra information that might interest you. Specifically, the reason you get lots of references to
$output->[1] in your last dump is that Data::Dumper does not do deepcopies by default: if it encounters array elements that point to the same thing, it prints a self-reference (hence
$output->[1]). You can control this behaviour with $Data::Dumper::Deepcopy. E.g.
use strict;
use Data::Dumper;
my $hashref= { 'one' => 'two' };
my $aryref=[ $hashref ];
push @$aryref, $hashref;
push @$aryref, $hashref;
print "Without Deepcopy: ".Dumper($aryref);
$Data::Dumper::Deepcopy=1;
print "With Deepcopy: ".Dumper($aryref);
print "Without Data::Dumper:\n";
print join("\n", @$aryref);
__END__
Without Deepcopy: $VAR1 = [
{
'one' => 'two'
},
$VAR1->[0],
$VAR1->[0]
];
With Deepcopy: $VAR1 = [
{
'one' => 'two'
},
{
'one' => 'two'
},
{
'one' => 'two'
}
];
Without Data::Dumper:
HASH(0x8111a94)
HASH(0x8111a94)
HASH(0x8111a94)
So, the weird stuff you saw was actually a Data::Dumper artifact. There are actually three identical references in the array, but Data::Dumper only derefs one by default.
Anyway, we now return you to the scheduled programme.
CU
Robartes-
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.