in reply to Nested LOOP in HTML::Template
The way that you have it, i believe that @inner will be taken in scalar context which will evaluate to the number of elements in inner.push @outer, { 'INNER' => \@inner };
But, when you then do
that will also re-initialize the reference in the value pointed to by 'INNER', because thats a ref to @inner.@inner = ();
UPDATE:
Forget about this part, i missed the part about resetting $n = 0;
I think that overall, you need to redefine your problem, because you only have 1 loop, and you want to build a 2 level structure. Also, your if ( $n == 1 ) clause will only be true once (on the second iteration), so only 1 thing will get pushed onto @outer.
|
|---|