The example given suggests he wanted a stable sorting,
hence my "use sort 'stable'". Your code only gives a stable
sorting because that happens to be the default on 5.8.0,
but that may change in a future version of perl (and if
a sort happens to be stable in pre-5.8.0, it's just a coincidence).