Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: True or False? A Quick Reference Guide

by Juerd (Abbot)
on Sep 29, 2005 at 12:23 UTC ( [id://496065]=note: print w/replies, xml ) Need Help??


in reply to True or False? A Quick Reference Guide

A quicker reference ;)

0/FALSE: 0, "0", "", undef 1/TRUE: everything else AND OR XOR NOT 0&0=0 0|0=0 0^0=0 !0=1 0&1=0 0|1=1 0^1=1 !1=0 1&0=0 1|0=1 1^0=1 1&1=1 1|1=1 1^1=0 & | ^ ~ <-- bitwise && || ! <-- logical, high precedence and or xor not <-- logical, low precedence

Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

Replies are listed 'Best First'.
Re^2: True or False? A Quick Reference Guide
by Juerd (Abbot) on Oct 25, 2005 at 06:43 UTC

    Perl 6:

    0/FALSE: 0, "0", "", undef ("0" is true if the type is Str) 1/TRUE: everything else AND OR XOR NOT +& +| +^ +^ <-- bitwise, numeric ~& ~| ~^ ~^ <-- bitwise, string ?& ?| ?^ ?^ <-- bitwise, boolean && || ^^ ! <-- logical, high precedence and or xor not <-- logical, low precedence
    • The difference between logical and bitwise boolean is that logical AND and OR return an operand, while bitwise AND and OR return boolean values (the original values are lost).
    • ?^/^^, and ?^/! are practically the same.
    • ^^ was missing in Perl 5.
    • +^, ~^, ?^ are both XOR and NOT, depending on whether they are used infix (in between) or prefix (in front).

    Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://496065]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2025-07-10 22:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.