#!/usr/bin/perl
 
# Example of how to swap variables in a single line using a bitwise XOR and no temp variable.
 
$x = 50;
$y = 33;
 
print "Starting with:\n";
print "X: $x\n";
print "Y: $y\n";
print "\n";
 
$x = $x ^ ($y = ($x = $x ^ $y) ^ $y);
 
print "Ending with:\n";
print "X: $x\n";
print "Y: $y\n";