in reply to Re: Numeric Sorting on Characters
in thread Numeric Sorting on Characters

Hi choroba,
Can you explain what is happening when @sorted is generated? I'm not sure how you were able to grep after sort. I do understand that the grep checks if the value equals "-", otherwise is pushes it to @dashed, but why "and 0"?
Thanks!

Replies are listed 'Best First'.
Re^3: Numeric Sorting on Characters
by choroba (Cardinal) on Aug 15, 2013 at 00:13 UTC
    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.
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ