in reply to Numeric Sorting on Characters
Probably the ternary operator to the rescue:
sort { ($passes->{$a}->{'cpu'} ne '-' ? $passes->{$a}->{'cpu'} : 0) <=> ($passes->{$b}->{'cpu'} ne '-' ? $passes->{$b}->{'cpu'} : 0) } keys %{$passes}
UPDATE: In addition to choroba's solution you're able to assign a different value in case of '-'.
McA
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Numeric Sorting on Characters
by AnomalousMonk (Archbishop) on Aug 14, 2013 at 23:10 UTC |