Precedence and Associativity

Let's discuss the precedence and associativity of arithmetic operators in this lesson.

Precedence

Operator precedence determines which operation is performed first in an expression with more than one operator. Operator precedence in Perl is similar to that of regular arithmetic operators.

  • *, /, % operators have equal precedence.
  • + , - operators have equal precedence.
  • *, / , % have a higher precedence than + , -.

The operator with higher precedence is executed first in an expression.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy