in reply to Problem iterating AoH

What is the $param returned for each 'type' key after the subroutine &return_param_name? I'd suggest you sprinkle some print statements around as follows and show what &return_param_name looks like,
my $value = $q->{'content'}; my $param = $q->{'type'}; print $param,"$/"; #<------------------Here #$value =~ s/^\s+|\s*$//g; $param = &return_param_name($param); print $param,"$/"; #<--------------------Here push @{$qryhash{$param}}, $value;
Since your problem lays in converting an AoH to a HoA by iterating over the AoH, using the Dumped output you provided it is possible to iterate as follows:
#!/usr/local/bin/perl #title "Problem iterating AoH" use strict; use warnings; my @queries = ( { 'content'=>'Blocking', 'type' => 'blocking' }, { 'content'=>'p01', 'type'=>'Priority' } ); my %hash; for my $reference (@queries){ push @{$hash{$reference->{'type'}}},$reference->{'content'}; } use Data::Dumper; print Dumper(\@queries),"\n"; print Dumper(\%hash);
OUTPUT:
$VAR1 = [ { 'content' => 'Blocking', 'type' => 'blocking' }, { 'content' => 'p01', 'type' => 'Priority' } ]; $VAR1 = { 'blocking' => [ 'Blocking' ], 'Priority' => [ 'p01' ] };


Excellence is an Endeavor of Persistence. Chance Favors a Prepared Mind.