>if (defined $x and length $x)
 >
 >So, is this the opposite?
 >
 >if (! defined $x and ! length $x)

I don't think so.  It's basic Aristotelian logic and can be determined
by truth tables or testing.  Questions are mere conjecture :)

The negative of a statement, A, is: not A.  That can be writted as: ! A
(with a difference in precedence binding.  See
http://www.perldoc.com/perl5.6/pod/perlop.html)

Now, A may be a conjunctive statement, such as ( B  and C ).  That means
the negative would be:

 1. not ( B and C )

 or

 2. ! (B and C)

By truth tables or experimentation that be be proved equivilant to the
following disjunctive statement:

 3. ( (! B) or (!C) )

 or

 4. ( (not B) or (not C) )

It is not equivilant to

 5. ( (! A) and (!B) )

 or

 6. ( ! (A and (!B) )

Because (B and C) is true only if (B is true and C is true), and it is
false if either (B is false xor C is false) or (both B and C are false).
If you use parenthesis as in statements (3) and (4) above, then you do
not need to worry about operator binding rules. 

If you want to craft very compact statements and programs to win perl
golf tournaments, that is the time to rely on the operator associativity
and precedence rules to eliminate all the parentheses you can!
(((((unless the game is to confound your opponent with a lot of
parentheses)))))

If you get really good at using a plethora of parentheses in even small
programs, then maybe you will like Lisp - (car '(a (b (c (d (e (f (g (h
(i (j (l (m n) o) p) q) r) s) t) u) v) w) y) z)) => a  
(http://www.lns.cornell.edu/public/COMP/info/emacs-lisp-intro/emacs-lisp
-intro_8.html)

-tristram


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to