in reply to Is Number
That's probably what you want since perl is only going to numify that string to 0. But if you're going to pass the string '0xa.8' to a function that handles such an input as intended, then you'd want your IsNumber() subroutine to return TRUE.>perl -MScalar::Util="looks_like_number" -we "print 'WTF' if looks_lik +e_number('0xa.8');" >
Other points of contention might be whether your IsNumber() function should return true for numeric objects like Math::BigInt, Math::BigFloat and Math::BigRat objects ... or maybe you don't even have to consider such inputs.>perl -MMath::MPFR -wle "print Math::MPFR->new('0xa.8');" 1.05e1 >
|
|---|