in reply to How swap works

In the case where the same variable appears on both sides of the assignment, perl makes a temporary copy of all the values of the RHS before performing the assignment.

Dave.