Perl Operators

Perl has an abundance of operators. Many of them come from the C programming language, some come from the UNIX shells, and others are strictly particular to Perl. Before we see the complete set of Perl operators, we must explain some preliminary concepts.

Precedence Versus Associativity

Operator precedence defines the order in which operators are to be executed. Operator associativity defines the order when there are ties in the precedence. For example, most languages define multiplication to be higher in precedence than addition, and thus the following evaluates to 17, and not 21.

$x = 2 + 5 * 3;

But what if an expression involves operators of the same precedence?

$x = 200 / 5 * 10;

The precedence does not tell us anything, ...

Get Programming PERL in the .NET Environment 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.