Книга: Fedora™ Unleashed, 2008 edition

Other Operators

Other Operators

Perl supports a number of operators that don't fit any of the prior categories. Table 25.5 summarizes these operators.

TABLE 25.5 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 ^ 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
a x b Repeats string a for b number of times
x , y Comma operator — evaluates x and then y
x ? y : z Conditional expression — if 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 +=.

Оглавление книги


Генерация: 0.838. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз