in reply to Numeric Sorting on Characters

Hmmm... the presence of a single “-” seems quite suspicious to me ... have you looked at the corresponding record in the input data, and if so, is it really just a dash?   Does this look like a possible bug in the program that produced the file?   (Hey, it happens ... a lot.)

“Making the immediate bug go-away” sometimes leaves you in a situation that is much worse.   Why is that dash there?   Is it really there (or is your parsing algorithm insufficient?).   Is it really correct to code your program to detect and to accept it?   Maybe the proper answer to all 3 questions is yes.   But then again, the software might be trying to tell you something.

Replies are listed 'Best First'.
Re^2: Numeric Sorting on Characters
by halecommarachel (Sexton) on Aug 16, 2013 at 20:24 UTC

    If the cpu time is not available, I set the value to "-". It's just a way of having a placeholder than returns true if tested with an if statement.

      Still, it leads to the Zen question "How do you do a numeric sort of non-numeric data?".