<D <M <Y
Y> M> D>

: It is Fun With Perl... yeah!


I thought it was impossible to swap two variables without using a third variable, but there it is. I forgot who posted this to the Fun With Perl list, but I am eternally grateful to them.

: You could make the case that that implicitly uses a third storage space to store the results of the xors before it is put into one of the variables, but even if that does happen, you could design a computer that didn't do that.

I feel like a new xor!


Unless otherwise noted, all content licensed by Leonard Richardson
under a Creative Commons License.