in reply to check if its a number

What do you mean by "is a number"? Between inclusively or exclusively? Is "01" ok? What about "000000000000000000000001"?

Here's one bad way:

$isanum = !($x !~ y/.//) + $x =~ y/0-9// == $x =~ y/0-9.//c + $x !~ y/ +0-9// + length($x) && $x <= 10;