Chapter 6. Where’s the Operator?

Where’s the Operator?

About Perl Operators

In the real world, there are operators who operate switchboards, computers, bulldozers, tanks, etc. In Perl, operators operate on numbers and strings or a combination of them. Operators are symbols, such as +, -, =, >, <, that produce a result based on some rules. An operator manipulates data objects called operands; e.g., 5 and 4 are operands in the expression 5 + 4. Operators and operands are found in expressions. An expression combines a group of values to make a new value, n = 5 + 4. And when you terminate an expression with a semicolon, you have a complete statement; e.g., n = 5 + 4.

Figure 6.1. Evaluating ...

Get Perl by Example, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.