The problem is that you are using a reference as index in an array.
I admit that this appears to be whats going on, But I do not understand how. I see no lookup of an array in that code.
Heres some toying I did with the problem.
#!perl -l use strict; use warnings; my $a = {child1 => [ {child2 => [ {child3 => [ {child4 => [1]} ]} ]} ] +}; print $a->{child1}{child2}{child3}; #cut off {child3} and no problem. print '$a:',ref $a; print '$a->{child1}:',ref $a->{child1}; print '$a->{child1}{child2}:',ref $a->{child1}{child2}; print '@{$a->{child1}}:',scalar @{$a->{child1}}; __END__ $a:HASH $a->{child1}:ARRAY $a->{child1}{child2}:HASH @{$a->{child1}}:28004977
So it would appear that somehow $a->{child1}{child2} is being treated as an array lookup. But how? There is no array lookup involved.
Id be interested to hear an explanation as to why this isnt a bug in perl.
First they ignore you, then they laugh at you, then they fight you, then you win.
-- Gandhi
In reply to Re: Re: Perl eats all memory when accessing hash/array refs wrong
by demerphq
in thread Perl eats all memory when accessing hash/array refs wrong
by jmo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |