in reply to Re: Integer detection concept
in thread Integer detection concept

For regular numbers, this is works, but it also claims 'integerness' for things like '2na' and '4ever'. Would a regexp be a reliable way of catching this, or is there something better?
sub is_int { ($_[0] =~ /^\-?\d+(?:\.\d+)?(?:e\+\d+)?$/ && $_[0] == int $_[0]); }

Replies are listed 'Best First'.
Re: Integer detection concept
by merlyn (Sage) on May 15, 2001 at 00:38 UTC