use Sort::Key::Multi qw(is_keysort il_keysort); # 'is_' and 'il_' indicate the sorting key types, # in that case: # is = integer + string # il = integer + locale_string my @sorted = is_keysort { (/(.)(.*)/)[1,0] } @data; my @locale_sorted = il_keysort { (/(.)(.*)/)[1,0] } @data;