Yes, this is one way to do it. I just did not want to decide for the OP what to do for undef, empty strings and other such special cases where it is difficult to figure out how to sort them without knowing the functional context. I'll gladly update my proposal when (and if) the OP gives additional information.