D.3. Operators
The following tables detail the various operators present in the Perl language.
D.3.1. Perl Arithmetic Operators
Operator | Use |
---|---|
+ | Addition |
- | Subtraction |
* | Multiplication |
/ | Division |
% | Modulus |
** | Exponent |
++ | Increment |
-- | Decrement |
D.3.2. Perl Assignment Operators
Operator | Use |
---|---|
= | Assignment |
+= | Increment assignment |
-= | Decrement assignment |
*= | Multiplication assignment |
/= | Division assignment |
%= | Modulus assignment |
**= | Exponential assignment |
.= | String concatenation assignment |
D.3.3. Perl Comparison Operators
Operator | Use |
---|---|
== | Numeric is equal to |
!= | Numeric is not equal to |
> | Numeric is greater than |
< | Numeric is less than |
>= | Numeric is greater than or equal to |
<= | Numeric is less than or equal to |
eq | String equality |
ne | String nonequality |
gt | String greater than |
lt | String less than |
ge | String greater than or equal to |
le | String less than or equal to |
D.3.4. Perl Logical Operators
Operator | Use |
---|---|
&& | And |
|| | Or |
! | Not |
D.3.5. Perl Bitwise Operators
Operator | Use |
---|---|
& | And |
| | Or |
^ | Xor |
~ | Not |
<< | Left shift |
>> | Right shift |
D.3.6. Perl Miscellaneous Operators
Operator | Use |
---|---|
. | Object/property/method separator |
? | Condition operator |
delete | Delete specified object |
new | Create new object |
this | Reference current object |
ref | Type of object (number, string, and so on) |
void | Evaluate expression without return value |
D.3.7. String Operators
Operator | Use |
---|---|
. | Concatenation |
x | Repetition |
D.3.8. String Tokens
Token | Character |
---|---|
\b | Backspace |
\e | Escape |
\t | Horizontal tab |
\n | Line feed |
\v | Vertical tab |
\f | Form feed |
\r | Carriage return |
\" | Double quote |
\' | Single quote |
\$ | Dollar sign |
\@ | At sign |
\\ | Backslash |
Get Web Standards Programmer's Reference: HTML, CSS, JavaScript®, Perl, Python®, and PHP now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.