When functions are chained, they are called from right to left. So, that's what happens: Keys are taken. For each key, if it is not a dash, it is left in the list that is later sorted. If it is a dash, it is pushed to @dashed
and 0 is returned so grep removes it from the list to be sorted.