my @sorted = sort { split_sort( fc($a), fc($b), 'type', 'split expr') } @array; # I made changes to split_sort detailed in a moment.