- or download this
my( $a, $b, $c ) = ( 1, 2, 3);
$a = $b = $c = 1;
print "$a$b$c";
- or download this
my($a,$b) = (23, 99);
$a ^= $b ^= $a ^= $b;
print "$a : $b";
99 : 23
- or download this
#! perl -slw
use strict;
...
'AB'
'BA'
'AB'
- or download this
Assignment operators work as in C. That is,
...
Unlike in C, the scalar assignment operator produces a valid lvalue. M
+odifying an assignment is equivalent to doing the assignment and then
+ modifying the variable that was assigned to. This is useful for modi
+fying a copy of something, like this:
($tmp = $global) =~ tr [A-Z] [a-z];