I need to get all of the values for a certain key in a hash. The hash looks like this:
$bean = {
Key1 => {
Key4 => 4,
Key5 => 9,
Key6 => 10,
},
Key2 => {
Key7 => 5,
Key8 => 9,
},
};
I just need the values to Key4
, Key5
and Key6
for example. The rest is not the point of interest. How could I get the values?
Update:
So I don't have a %bean
I just add the values to the $bean
like this:
$bean->{'Key1'}->{'Key4'} = $value;
hope this helps.