Table 275 Other Perl Operators

Operator Purpose

~x Bitwise not (changes 0 bits to 1 and 1 bits to 0)

x & y Bitwise and x | y Bitwise or x A y Bitwise exclusive or (xor)

x << y Bitwise shift left (shifts x by y bits)

x >> y Bitwise shift right (shifts x by y bits)

x . y Concatenate y onto x

Operator Purpose a x b Repeats string a for b number of times x , y Comma operatorevaluates x and then y x ? y : z Conditional expressionif x is true, y is evaluated; otherwise, z is evaluated

Except for the comma operator and conditional expression, these operators can also be used with the assignment operator, similar to the way addition (+) can be combined with assignment (=), giving +=.

Was this article helpful?

0 0

Post a comment