J
John Cecere
Since
if ("aaa" == 0) {
print "true\n";
}
will print true, how does one go about testing a value as an integer. For example, the user enters data:
$a=<STDIN>;
The user might accidentally type in character data, but I need to perform a test to see if what they entered is a number between 0
and 255, and return a bad status for anything else. Doing this:
if ($a < 0 || $a > 255)
won't catch character data.
What's the _simple_ way of doing this ?
Thanks,
John Cecere
if ("aaa" == 0) {
print "true\n";
}
will print true, how does one go about testing a value as an integer. For example, the user enters data:
$a=<STDIN>;
The user might accidentally type in character data, but I need to perform a test to see if what they entered is a number between 0
and 255, and return a bad status for anything else. Doing this:
if ($a < 0 || $a > 255)
won't catch character data.
What's the _simple_ way of doing this ?
Thanks,
John Cecere