in reply to Custom "sort" routine

First of all you don't use $sub1 and $sub2 in your code. Second point is that if you split on a dot, the first item of the array will be empty, $tld1 will be just com (as pointed out by ambrus++ in the CB).