Warning! This trick is not so good to use for floating point numbers because of machine epsilon. For example, this (shortened) version of the above program

printf("%g %g\n",$a, $b);
$a=$a+$b; $b=$a-$b; $a=$a-$b;
printf("%g %g\n", $a, $b);
will demonstrate catastrophic cancellation when used like this:
$ ./foo.pl 1.e5 1.e-11
100000 1e-11
1.45519e-11 100000

(Note that the smaller number now has an error of around 50%)