in reply to Check if a key exists in several hashes at once

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.

Replies are listed 'Best First'.
Re^2: Check if a key exists in several hashes at once
by eyepopslikeamosquito (Archbishop) on Nov 13, 2010 at 01:36 UTC

    Note that this common precedence booboo can be avoided by following the advice in Chapter 4, "Values and Expressions" of Perl Best Practices.

    See especially item 4.16: "Don't mix high- and low-precedence booleans".