Randal L. Schwartz wrote
: For integers, you can narrow it down:
: 
:     sub is_integer {
:       my $bad = 0;
:       local $SIG{__WARN__} = sub { $bad++ };
:       local $^W = 1;
:       my $guess = shift;
:       return $guess == int($guess) and not $bad;
:     }

oops, precedence:

return $guess == int($guess) && not $bad;

Otherwise everything's an integer.

-- tdk

Reply via email to