in reply to This is why Perl is so frustrating

if (($file ne ".") or ($file ne ".."))

Will always be true, because no single value of $file can ever match both "." and "..". So yes, you are missing a fundamental aspect of logical operations.

Namely: For a given A != B, (!A or !B) == !(A && B), which will always be true for any single value.

Update:
Perhaps you should spend some time reading this article.

Replies are listed 'Best First'.
Re^2: This is why Perl is so frustrating
by ikegami (Patriarch) on Jul 29, 2009 at 23:03 UTC

    Namely: For a given A != B, (!A or !B) == !(A && B), which will always be true for any single value.

    ow.

    You attached two conditions to (!A or !B) == !(A && B), but it's always true.

    You refer some non-existent "single value" because you meant to talk about (V != A) or (V != B).


    I believe you meant:

    (A or B)
    is equivalent to
    !(!A and !B)
    Because of that,
    (V != A) or (V != B)
    is equivalent to
    !( (V == A) and (V == B) )

    If A != B, the "and" is obviously false (since V can't have two different values at the same time), and the whole statement is therefore true.

      Yeah, I changed which side of the statement I was adding the A != B qualifier, didn't clean it up well. Thanks for clarifying it.