This tutorials explains about Perl availiable Operators.

What are operators in Perl

Operators are basic components of programming language. Operators helps to mutates the variables or operands.

There are two types of operator

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

Perl Operator types

Perl language provides different type of operator

  • Arithmatic 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 operator 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