Relational and Logical Operators in PERL
Relational and Logical Operators in PERL
All programming languages have Relational and logical operators. Lets discuss on what Perl has as relational & logical operators.
- The relational & logical operators are used with conditional statements and looping statements.
- Perl’s relational and logical operators are same as C language and shell script.
- All operators’ returns true if the condition satisfies else return False.
Relational operators
The C way
|
The shell script way
|
Description
|
>
|
gt
| Greater than |
<
|
lt
| Less than |
>=
|
ge
| Greater than equal to |
<=
|
le
| Less than equal to |
==
|
eq
| Equals |
!=
|
ne
| Not equal |
Logical operator
The C way
|
Description
|
&&
| and operator |
||
| or operator |
!
| not operator |
Other file operations
Operators
|
Description
|
-e filename | File exist |
-f filename | Plane file |
-d filename | Directory |
-s filename | File size not zero |
-r filename | File readable |
-w filename | File writable |
-x filename | File executable |
Comments
Post a Comment