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