1. Numeric Operators: + (Plus),-(minus), * (multiplication),/(Division), ** (multiplication party/power), % (remainder );
These operators mix integers, floating-point numbers, and real numbers. The calculation results are in the correct numeric context;
Compound assignment operator:
+ =,-=, * =,/=, ** =, % = ,. =, & =, | =, ^ =, <=, >>=, & =, | =;
Auto-increment/auto-increment operator: ++ /--
++ Operators can be used in addition to numeric operations and string operations, while -- operators can only be used in numeric operations;
For example: $ STR = "ABC ";
$ STR ++;
$ STR = "Abd ";
2. Conditional operators:
Conditional operators in Perl have two types: numeric comparison operators and string comparison operators. Their return values are boolean values. Boolean values can only be true or false. in Perl, numbers 1 are used to represent true, and numbers 0 are used to represent false;
A. numeric comparison operators:
>,>=, <, <=, = ,! =, <=>;
The <=> return values include:
-1: The left side is smaller than the right side.
1: The left side is greater than the right side
0: left equals right
B. String comparison operators:
(1) string join OPERATOR :.
(2) string repetition operator: x
(3) string join value assignment operator:. =
There are several main types: Lt (less than), GT (greater than), eq (equal to), Le (less than or equal to), Ge (greater than or equal to), NE (not equal), CMP (comparison );
Comparison between string comparison operators and numeric comparison operators:
String comparison numeric comparison description
Lt <the expression on the left of the operator is smaller than the expression on the right of the operator
GT> the expression on the left of the operator is greater than the expression on the right of the operator
Eq = equals the expression on the left to the expression on the right of the operator
Le <= expression on the left of the operator that is less than or equal to the operator's Edge
GE> = the expression on the left of the operator is greater than or equal to the expression on the right of the operation.
Ne! = The expression on the left of the operator is not equal to the expression on the right of the operator
CMP <=> the expression on the left of the operator is compared with the expression on the right of the operator,
If the return value is less than-1, the return value is greater than 1, and the return value is equal to 0.
During string comparison, the perl interpreter converts each character in the two strings into the corresponding ASCII value, and then compares the corresponding characters in the two strings, until the comparison is complete;
3. logical operators:
Logic and: & or and
Logic or: | or
Non-logical :! Or not
Logic exclusive or: XOR
The logical operators in Perl also follow the "Short Circuit" logic Evaluation Principle in C/C ++;
4. bitwise operators:
& Bitwise AND
| By bit or
~ Non-bitwise
^ Bitwise OR
<Left shift
> Right shift
5. Block operators:
It is a special operator of Perl, represented by "..."; for example:
@ Digits = (1 .. 9); # A list from 1 to 9 is generated;
@ Chars = ('A' .. 'Z'); # An ordered list from 'A' to 'Z' is generated;
This operator is also called a list range operator;
6. Ternary conditional operators:
Like C/C ++, Perl also has a ternary conditional OPERATOR:
Logical expression? Expression 1: expression 2;
7. Comma OPERATOR:
The expression before the comma operator performs operations first, and evaluates values sequentially from left to right. The entire expression returns the value of the last expression in the comma operator;