Next: The Binary Arithmetic Operators Up: Practical Perl Programming Previous: Associative Array Operators

# Operators

The operators in a computer language tell the computer what actions to perform. Perl has more operators than most languages. You've already seen some operators-like the equals or assignment operator(=). As you read about the other operators, you'll undoubtedly realize that you are familiar with some of them. Trust your intuition; the definitions that you already know will probably still be true.

Operators are instructions you give to the computer so that it can perform some task or operation. All operators cause actions to be performed on operands. An operand can be anything that you perform an operation on. In practical terms, any particular operand will be a literal, a variable, or an expression. You've already been introduced to literals and variables. A good working definition of expression is some combination of operators and operands that are evaluated as a unit. Chapter 6 "Statements," has more information about expressions.

Operands are also recursive in nature. In Perl, the expression 3 + 5-two operands and a plus operator-can be considered as one operand with a value of 8. For instance, (3 + 5) - 12 is an expression that consists of two operands, the second of which is subtracted from the first. The first operand is (3 + 5) and the second operand is 12.

This chapter will discuss most of the operators available to you in Perl . You'll find out about many operator types and how to determine their order of precedence. And, of course, you'll see many examples.

Precedence is very important in every computer language and Perl is no exception. The order of precedence indicates which operator should be evaluated first.

Next: The Binary Arithmetic Operators Up: Practical Perl Programming Previous: Associative Array Operators
dave@cs.cf.ac.uk