in reply to Re: logical Exclusive Or, xor
in thread logical Exclusive Or, xor

I don't follow why xor is useless, and and isn't. Afterall, if I'm not interested in the result, I can write
EXPR1 and EXPR2;
as
if (EXPR1) {EXPR2}

And something similar for or.

I've used xor, although not very often. A few months ago I used it in a program that took command line arguments. 2 options where multiple exclusive, but at least one of them had to be used. So I had something like:

unless (defined ($opt1) xor defined ($opt2)) { die "usage message"; }

I don't use xor often, but I still use it more than CGI.pm ;-).

Abigail

Replies are listed 'Best First'.
Re^3: logical Exclusive Or, xor
by Aristotle (Chancellor) on Oct 14, 2002 at 14:22 UTC
    Afterall, if I'm not interested in the result, I can write EXPR1 and EXPR2; as if (EXPR1) {EXPR2}
    The former is what fruiture was doing. He was talking about shortcircuiting effects, after all. xor doesn't posess any.

    Makeshifts last the longest.