#define 3 variables, 2 for storage, one for temp... my ($a, $b, $c); #set the two variables to some value $a = 5; $b = 6; #use the temp value to swap them $c = $a; $a = $b; $b = $c; #now, $a has $b and $b has what $a had