Tuesday, 11 March 2014

Logical Operators:



Perl Logical Operators:

There are following logical operators supported by Perl language. Assume variable $a holds true and variable $b holds false then:
Operator
Description
Example
and
Called Logical AND operator. If both the operands are true then then condition becomes true.
($a and $b) is false.
&&
C-style Logical AND operator copies a bit to the result if it exists in both operands.
($a && $b) is false.
or
Called Logical OR Operator. If any of the two operands are non zero then then condition becomes true.
($a or $b) is true.
||
C-style Logical OR operator copies a bit if it exists in eather operand.
($a || $b) is true.
not
Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true then Logical NOT operator will make false.
not($a and $b) is true.

No comments: