The problem with xor on strings is it will extend short ones. There are now 0 bytes there that weren't there before, and length changes.
$ perl -e'$a="a"; $b="bbb"; $a^=$b; $b^=$a; $a^=$b; print "/$a/,/$b/\n +"; print length($a),"\n"; print length($b),"\n"' /bbb/,/a/ 3 3
In reply to XOR swap bad...
by RMGir
in thread Algorithm Pop Quiz: Sorting
by clintp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |