1. Perl
  2. Operators

Perl operators

A list of Perl operators . Perl has a few more operator types than other languages. It may be one of the reasons why I feel a lot of symbols. If you don't know the operator, you can look it up here.

String operators

Introducing operators related to strings.

*operator *meaning
.. String concatenation operator
qw String list operator
& lt; & lt; EOS Here document
q Quart operator
qq Double quote operator
x Repeat operator

See the following articles for a detailed explanation of string comparison operators.

Regular expression operators

Introducing operators related to regular expression.

*operator *meaning
=~ Pattern matching operator
qr Regular expression reference
m Regular expression enclosing expression

Array operators

Introducing operators related to arrays.

*operator *meaning
() List
@elems [ 1, 3, 5 ] Array slice
qw String list operator
m .. n Range operator
x Repeat operator

Hash operators

Introducing operators related to hashes.

@hash {'foo', 'bar'} Hash slice

Reference operators

Anonymous array generator
{} Anonymous hash generator

Control structure operators

Introducing operators related to control structures.

*operator *meaning
A? B: C Ternary operator
// // Defined-or operator

Numeric comparison operator

Introducing numeric comparison operators for comparing numbers.

*operator *meaning
A == B A and B are equal
A != B A and B are not equal
A> B A is greater than B
A >= B A is B or higher
A A is less than B
A <= B A is less than or equal to B

See below for a detailed explanation of numeric comparison operators.

String comparison operator

Introducing the string comparison operator for comparing strings.

*operator *meaning
A eq B A and B are equal
A ne B A and B are not equal
A gt B A is greater than B
A ge B A is B or higher
A lt B A is less than B
A le B A is less than or equal to B

See below for a detailed explanation of string comparison operators.

Logical operators

Introducing Perl logical operators.

*operator *meaning
| | Logical sum
&& Logical AND
!! denial
or OR (lower priority than | |)
and Lower priority than AND &&)
not Negation (lower priority than!)

See below for a detailed explanation of logical operators.

Arithmetic operator

This is an introduction to arithmetic operators for performing four arithmetic operations.

|

*operator *meaning
+ Addition operator
- - Subtraction operator
* Multiplication operator

/

Division operator
%% Modulo operator
++ Increment
- Decrement
* * Exponentiation operator

See below for a detailed explanation of arithmetic operators.

Bitwise operator

An operator for performing Perl bit operations .

*operator *meaning
& Bit AND
| Bit OR
^^ Bit exclusive OR
~ Bit denial
& lt; & lt; Right bit shift
& gt; & gt; Left bit shift

See the following article for an explanation of bit operations.

Operators for assignment

Introducing operators related to assignment.

*operator *meaning
= = Assignment operator

Special assignment operator

Introducing special assignment operators. It can be used in combination with other operators like "A += B" and has the same meaning as "A = A + B".

*operator *meaning
A += B A = A + B
A-= B A = A - B
A *= B A = A * B
A/= B A = A/B
A | = B A = A | B
A & = B A = A & B
A ^ = B A = A ^ B
A && = B A = A && B
A | | = B A = A | | B
A //= B A = A // B
A. = B A = A. B

File I/O operators

Introduces I/O operators to the file.

*operator *meaning
& lt; & gt; File input operator

Operators related to file operations

Introducing operators related to file operations.

*operator *meaning
_ Reuse of file information

File test operator

Introducing the file test operator.

* File test operator *function
-e Check if the file exists
-f Normal faCheck if Il exists
-d Check if the directory exists
-s Get file size
-M Get the number of days that have passed since the last update
-A Get the number of days that have passed since the last access

Other operators

Introducing other operators.

... Yadayada operator

Operator "priority"

Explains Perl operator precedence.

How to check Perl grammar/syntax

To find out the grammar and syntax of Perl such as if and for, see the following articles.

Official documentation for operators

See the official documentation for a complete list of Perl operators.

Related information

See the following pages for Perl grammar/syntax, functions, predefined variable/modules.

Related Informatrion