1 |
thatcommand if thiscondition; # is equivalent to
|
2 |
thiscondition && thatcommand;
|
3 |
PERL will not continue with && (logical and) if it finds a false condition. So if thiscondition is false, thatcommand is not executed
|
4 |
Similarly:
|
5 |
thatcommand unless thiscondition; # is equivalent to
|
6 |
thiscondition || thatcommand;
|
7 |
Note can use and instead of && and or instead of ||
-
not (instead of !) and xor (instead of ^) also allowed
|
8 |
We can use a C-like if-expression
|
9 |
expression ? Truecalc : Falsecalc; # which is equivalent to
|
10 |
if (expression) { Truecalc; } else { falsecalc; }
|