Assignment Operators

Perl recognizes the following operators for assigning a value to a variable:

=    **=    +=    *=    &=    <<=    &&=
-=    /=    |=    >>=   ||=    .=     %=
^=    x=

Each operator requires a variable on the left side and an expression on the right side. For the simple assignment operator, =, the value of the expression is stored in the designated variable. For the other operators, Perl evaluates the expression:

$var OP= $value

as if it was written:

$var = $var OP $value

except that $var is evaluated only once. For example:

$a += 2;    # Same as $a = $a + 2
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.44.52