This tutorial explains Perl available Operators.

What are operators in Perl

Operators are basic components of programming language. Operators help to mutate the variables or operands.

There are two types of operator

  • Unary Operator: Applies to the single operand.
  • Binary Operator: Operators apply to two operands.

Perl Operator types

Perl language provides different types of operator

  • Arithmetic Operators Arithmetic operators are used to calculate arithmetic mathematical operations.

  • Logical Operator

  • Comparison Operator

  • Assignment Operators

  • Relational operators

  • Equality operators

  • Bitwise operator

  • Comma Operator

  • Conditional operator

  • String operator

  • Pattern match Operators

  • Auto Increment and Decrement Operators

  • File Test Operator

  • quote operator

Quote operator

quote operators are used to create a string literal. There are three operators.

  • q operator: String enclosed in single quotes, which is equal to ‘string’
  • qq operator: String enclosed in double quotes, which is equal to “string”
  • qx operator: String enclosed in backtick quotes, which is equal to ‘string’

Example quote operators in Perl

$str = q(one);
print "$str\n" # one
$str1 = qq(one);
print "$str1\n" #one
$str2 = qx(one); 
print "$str1\n" #one