Binary **
is the
exponentiation operator. Note that it binds even more tightly than
unary minus, so -2**4
is -(2**4)
, not (-2)**4
. Also note that **
has right associativity, so:
$e = 2 ** 3 ** 4;
evaluates to 2 to the 81st power, not 8 to the 4th power.
The *
(multiply)
and /
(divide) operators work
exactly as you might expect, multiplying or dividing their two
operands. Division is done in floating-point mode, unless integer
mode in enabled (via use
integer
).
The %
(modulus)
operator converts its operands to integers before finding the
remainder according to integer division. For the same operation in
floating-point mode, you may prefer to use the fmod( )
function from the POSIX module
(see Chapter 8).
3.139.83.151