On Monday 28 July 2003 2:55 pm, West, William M wrote:
> #!/usr/bin/perl -w
>
> use strict;
> use diagnostics;
>
>
> my $a = 1;
> my $b = 2;
> my $c = 2;
> my $d;
>
> print "xor1" if ($a = $a) ^ ($b = $c);#prints

Presumably this is because you're using the assignment operator and not the 
comparison operator.

print "xor1" if ($a == $b) ^ ($b == c);

should work as expected.


>
> print "xor2" if ($a = $b) ^ ($b = $c);#no print
>
> print "xor3" if ($a = $b) xor ($b = $c);#no print
>
> print "xor4" if ($a = $a) xor ($b = $c);#no prints
>
> print "xor5" if $a xor $b;#no prints
>
> print "xor6" if $a xor $d;#prints
>
>
> # so --- how do i use xor and ^ ???   i'd like to use it
> # for statements like the first few.... *sigh*
> #
> # i don't understand why the first one prints.... i really
> # need clarification on this one!
> #
> #
>
> thanks  :)
>
>
> willy
> http://www.hackswell.com/corenth

-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000     


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

Reply via email to