It seems to me you're misunderstanding how hashes work. Keys in a hash are unique. What this means is that you can't have two or more identical keys with different values.
If you want to test whether a certain key exists and has the value you expect, you can do this
if (defined $foo{'bar'} and $foo{'bar'} eq 'baz'){
}