in reply to Really slow sort, but useful.

Perhaps (though overengineering is often discouraged) you might use AI::Fuzzy to build and interrogate the Darker than the "^" char, lighter than the "." char properties of "~".

I should point out that I have been really meaning to get around to looking at that module for a few weeks, but not actually used it yet. :( !