A lot of the discussion so far has hinged on how to tell strings from numbers (eq vs. ==), so I'm surprised no-one has mentioned Scalar::Util's looks_like_number() yet... the only downsides I see so far are that it might not be as fast as some other heuristic, and that sometimes I might want to actually compare two numbers as strings explicitly. (Okay one more... looks_like_number recognizes a few strings as numbers, such as "Inf", "Infinity", "NaN" and "0 but true". And it doesn't recognize "1_000" as a number... hmmm. See Perl_grok_number() in numeric.c)
In reply to Re: Bring back the smartmatch operator (but with sane semantics this time)!
by Anonymous Monk
in thread Bring back the smartmatch operator (but with sane semantics this time)!
by smls
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |