in reply to Remove one level from array
What you have is an array of arrays of hashes. You can not strip off the outer array, or else you'd be trying to stuff a bunch of array refs into a single scalar, and that won't fly.
What I think you want to do is simply iterate over the encompassing array and act on each inner aref one at a time:
my @numbers = collect(@test); sub collect { my @test = @_; my @all; for my $more_rec (@test){ for my $number (keys %{ $more_rec }){ my $numbers = $more_rec->{$number}; push @all, $numbers->{agenda}; } } return @all; }
However, it's doubly difficult to really understand what you want, because your data examples do not jive with what was in your collect() function. In there, you're extracting an href ($numbers) from within another href ($more_rec), and then from within $numbers, you're extracting the value of the agenda key. None of that is shown in your example data. Also, your collect() has at least one issue. You extract $number from keys(), but then never proceed to use it.
|
|---|