From the course: Perl 5 Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Logical operators - Perl Tutorial
From the course: Perl 5 Essential Training
Logical operators
- [Voiceover] Logical operators are used to perform Boolean operations on logical values. Here's a working copy of relational.pl from chapter eight of the exercise files. Perl has two sets of logical operators for two different purposes. Low precedence logical operators are used to bind logical expressions according to Boolean rules. For example, we have this conditional expression here that we used earlier in this chapter, and if I run this you see it says false, because a is not actually equal to b, a is a seven, and b is 42. Now if I come down here and I say if a equals b, or rather, if a equals c, and $b is equal to $d, we notice that a is equal to c, and b is equal to d, so we should get true. And I'll run that, and you see that the result is true. So this and, right there, is a logical operator. It's very low priority, and so the expressions on either side of it are always going to be evaluated first. And this makes it very useful for this sort of usage. Now, just so that we can…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
-
(Locked)
About Perl's operators2m 35s
-
(Locked)
Basic arithmetic operators5m 30s
-
(Locked)
Compound assignment operators2m 5s
-
(Locked)
Relational operators3m 27s
-
(Locked)
Logical operators6m 1s
-
(Locked)
File test operators3m 42s
-
(Locked)
The range operator2m 54s
-
(Locked)
The string concatenation operator1m 31s
-
(Locked)
Quote operators4m
-
(Locked)
-
-
-
-
-
-
-
-