@list= sort { my ($sub1,$tld1)=split /\./,$a; my ($sub2,$tld2)= split /\./,$b; $tld1 cmp $tld2 } @list;