From: Rado Petrik <[EMAIL PROTECTED]>
> I have two number 
> 
> $a=6;  #binary - 0110
> $b=10; #         1010
> 
> I need work this operation  "a OR b"     
>     0110  - 6 
> OR  1010  - 10
> ---------
>     1110  - 14  this is true;
> 
> buy when I use this operator "^" in perl 
> 
> $a^$b  then output is 12
> 
>     0110  - 6 
> OR  1010  - 10
> ---------
>     1100  - 12 false; 
> 
> Why ?

^ is XOR. That is exclisive OR ... the resul with have 1 only on 
those places where either one or the other argument had 1, but not 
both.

0 XOR 0 = 0
0 XOR 1 = 1
1 XOR 0 = 1
1 XOR 1 = 0

What you want is

        $a | $b

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


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

Reply via email to