isnum#

Whether a value is a number, and which kind.

Synopsis#

use Scalar::Util::Numeric qw(isnum);
my $flags = isnum($v);

What you get back#

0 when $v is not a number or is undef; otherwise the flags of perl’s number parser: 0x01 fits an unsigned integer, 0x02 is larger, 0x04 has a fraction or exponent, 0x08 is negative, 0x10 is infinity, 0x20 is NaN. Leading and trailing whitespace is allowed, as perl allows it when it converts a string.