Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Numeric Sorting on Characters

by sundialsvc4 (Abbot)
on Aug 14, 2013 at 20:54 UTC ( #1049476=note: print w/ replies, xml ) Need Help??


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.


Comment on Re: Numeric Sorting on Characters
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?".

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1049476]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2014-11-28 04:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (193 votes), past polls