idiomatic perl - sorting