<?xml version="1.0" encoding="windows-1252"?>
<node id="1007814" title="Re: Passing a reference from a subroutine." created="2012-12-07 14:23:55" updated="2012-12-07 14:23:55">
<type id="11">
note</type>
<author id="922586">
Lotus1</author>
<data>
<field name="doctext">
&lt;p&gt;When you call the sub like this &lt;c&gt;my $alldata= get_data();&lt;/c&gt; you aren't passing anything to the subroutine. There is no data for it to get.&lt;/p&gt;
&lt;p&gt;When you do this &lt;c&gt;$one_num = $infs-&gt;{ $one_num },&lt;/c&gt; where was the value for &lt;c&gt;$one_num&lt;/c&gt; initialized? It doesn't look like it was initialized to anything so the value inside the brackets is going to be undef. Are you using warnings? Strict?&lt;/p&gt;
&lt;c&gt;
my $c = -1;
...
foreach my $infs (@{ $data-&gt;{ info } }) {
    $c++;
    ...
    push @{ $AoA[$c] },
&lt;/c&gt;
&lt;p&gt;A more Perlish way to do this is to push each value into a temporary array inside the loop and then push that array into @AoA at the end of each itteration. This would drop out all the loop variables and simplify the notation.&lt;/p&gt;

</field>
<field name="root_node">
1007775</field>
<field name="parent_node">
1007775</field>
</data>
</node>
