When you call the sub like this my $alldata= get_data(); you aren't passing anything to the subroutine. There is no data for it to get.
When you do this $one_num = $infs->{ $one_num }, where was the value for $one_num 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?
my $c = -1; ... foreach my $infs (@{ $data->{ info } }) { $c++; ... push @{ $AoA[$c] },
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.
In reply to Re: Passing a reference from a subroutine.
by Lotus1
in thread Passing a reference from a subroutine.
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |