in reply to Passing a reference from a subroutine.
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Passing a reference from a subroutine.
by Anonymous Monk on Dec 07, 2012 at 20:26 UTC |