You are having a problem with operator precedence. && is a higher precedence operator than not. For example, print not 0 && not 1 outputs 1 because you are really executing print not(0 && not(1)). You will get your expected result by either using the high-precedence ! or low-precedence and. See Operator Precedence and Associativity for more info.
Comment on Re: Check if a key exists in several hashes at once