in reply to sorting with number then string

Reading the documentation:
Binary "<=>" returns -1, 0, or 1 depending on whether the left argument is numerically less than, equal to, or greater than the right argument.
...
Binary "cmp" returns -1, 0, or 1 depending on whether the left argument is stringwise less than, equal to, or greater than the right argument.

So that's why your numbers are being treated as strings: you've used the string comparison.

Next problem: "how to sort on multiple keys" is left as an exercise for the reader.

--
Tommy
Too stupid to live.
Too stubborn to die.