Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1

operators and their meanings.


Table 46.3 Compound Pattern Operators in Perl


OperatorMeaning

&& Logical  AND

|| Logical  OR

! Logical   NOT

() Parentheses; used    to  group   compound    statements

Arithmetic Operators


Perl supports a variety of math operations. Table 46.4 summarizes these
operators.


Table 46.4 Perl Arithmetic Operators


OperatorPurpose

x**y Raises x   to  the y   power   (same   as  x^y)

x%y Calculates  the remainder   of  x/y

x+y Adds    x   to  y

x-y Subtracts   y   from    x

x*y Multiplies  x   by  y

x/y Divides x   by  y

-y Negates  y   (switches   the sign    of  y); also    known   as  the unary   minus

++y Increments  y   by  1   and uses    the value   (prefix increment)

y++ Uses    the value   of  y   and then    increments  by  1   (postfix    increment)
Free download pdf