@arr = sort { ("X" eq substr($b,0,1)) <=> ("X" eq substr($a,0,1)) or $a cmp $b} @arr;