You want to exchange the values of two scalar variables, but don't want to use a temporary variable.
($VAR1, $VAR2) = ($VAR2, $VAR1);
Most programming languages force you to use an intermediate step when swapping two variables' values:
$temp = $a; $a = $b; $b = $temp;
$a = "alpha"; $b = "omega"; ($a, $b) = ($b, $a); # the first shall be last -- and versa vice
You can even exchange more than two variables at once:
($alpha, $beta, $production) = qw(January March August); # move beta to alpha, # move production to beta, # move alpha to production ($alpha, $beta, $production) = ($beta, $production, $alpha);
When this code finishes,
$production have the values "
August", and "