http://qs321.pair.com?node_id=80527


in reply to Integer detection concept

As one might expect, this is already answered in the FAQ:
How do I determine whether a scalar is a number/whole/integer/float?

Assuming that you don't care about IEEE notations like "NaN" or "Infinity", you probably just want to use a regular expression.

... if (/^-?\d+$/) { print "is an integer\n" } if (/^[+-]?\d+$/) { print "is a +/- integer\n" } ...