Chapter 6. Where’s the Operator?

Image

In the real world, there are operators who operate switchboards, computers, bulldozers, tanks, and so forth. 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. This chapter is all about Perl operators, their use, and their rules.

By the end of this chapter, you should be able to explain how Perl evaluates the following example:

$year=(localtime)[5] + 1900;$year % 100 == 0 && $year % 400 == 0 || $year % 100 != 0 &&$year % 4 == 0? printf "Year %d is leap year.\n",$year : ...

Get Perl by Example 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.