Note! This site is about Perl 6.
If you are looking for a solution for Perl 5, please check out the Perl 5 tutorial.
and
&&
or
||
orelse
//
xor
^^
not
!
if COND and COND {
}
if COND or COND {
}
if not COND {
}
tutorial/scalars/logical_operators.p6
#!/usr/bin/env perl6
use v6;
say (2 and 1); # 1
say (1 and 2); # 2
say (1 and 0); # 0
say (0 and 1); # 0
say (0 and 0); # 0
say "---";
say (1 or 0); # 1
say (1 or 2); # 1
say (0 or 1); # 1
say (0 or 0); # 0
say "---";
say (1 // 0); # 1
say (0 // 1); # 0
say (0 // 0); # 0
say "---";
say (1 xor 0); # 1
say (0 xor 1); # 1
say (0 xor 0); # 0
say (1 xor 1); # Nil
say "---";
say (not 1); # False
say (not 0); # True
say "---";
The Perl 6 Tricks and Treats newsletter has been around for a while.
If you are interested to get special notification when there is new content
on this site, it is the best way to keep track:
This is a newsletter temporarily running on my personal site (szabgab.com) using Mailman,
till I implement an alternative system in Perl 6.
Written by Gabor Szabo