The only time it is important to have the check is when your swap will run into trouble if the two elements are the same. This is true in C if you are using xor to perform the swap in place. It is not true in Perl. Therefore in Perl it is both faster and clearer to drop the check.
In reply to Re (tilly) 2 (small optimization): Extract random records from text file
by tilly
in thread Extract random records from text file
by SuperCruncher
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |