perl operators

Perl has a wide variety of operators, including:

  1. Arithmetic operators:
  • Addition: +
  • Subtraction: -
  • Multiplication: *
  • Division: /
  • Modulus: %
  • Exponentiation: **
  1. Assignment operators:
  • Simple assignment: =
  • Compound assignment: +=, -=, *=, /=, %=, **=
  1. Comparison operators:
  • Equality: ==
  • Inequality: !=
  • Greater than: >
  • Less than: <
  • Greater than or equal to: >=
  • Less than or equal to: <=
  • String comparison: eq, ne, gt, lt, ge, le
  1. Logical operators:
  • Logical AND: &&
  • Logical OR: ||
  • Logical NOT: !
  1. Bitwise operators:
  • Bitwise AND: &
  • Bitwise OR: |
  • Bitwise XOR: ^
  • Bitwise NOT: ~
  • Left shift: <<
  • Right shift: >>
  1. Conditional operators:
  • Ternary operator: ?:
  • Defined-or operator: // (introduced in Perl 5.10)
  1. Regular expression operators:
  • Match operator: =~
  • Negated match operator: !~
  • Substitution operator: s///
  • Transliteration operator: tr///
  1. Range operators:
  • Range operator: ..
  • Exclusive range operator: ...
  1. List operators:
  • List concatenation: .
  • Array slice: @array[start..end]
  • List assignment: ($var1, $var2) = (1, 2)
  1. File test operators:
  • Existence test: -e
  • File type test: -f, -d, -l, -p, -S, -b, -c
  • File permission test: -r, -w, -x, -o, -R, -W, -X

These are just some of the many operators available in Perl.