Someone asked in the CB how to sort alphabetically, but to have all items beginning with "X" to be listed first.
My solution:@arr = sort { ("X" eq substr($b,0,1)) <=> ("X" eq substr($a,0,1)) or $a cmp $b} @arr;
Very simplistic and note this is in ASCII order not true alpa. For that apply lc.
In reply to A CB Sorting Question by lemming
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |