Is it possible to filter the output generated by an Array of hashreferences to only print that array elements hash reference if it contains a specific key or value, with that i mean print out the entire hash of that array element. This example code would print out every hash in every element:
for $i ( 0 .. $#AoH ) {
print "$i is { ";
for $role ( keys %{ $AoH[$i] } ) {
print "$role=$AoH[$i]{$role} ";
}
print "}\n";
}
How would i go about filtering that output to only print the elements that has a hashref that contain a certain key or value ?
Example hashref in :
push @AoH, { husband => "fred", wife => "wilma", daughter => "pebbles" };
output:
husband=fred wife=wilma daughter=pebbles
Example data would only be printed out if it one of the keys (husband/wife/daughter) or one of the values (fred/wilma/pebbles) were specified in some sort of if-statement(?)