use Scalar::Util; . . if(Scalar::Util::looks_like_number($x) && $x > 0) { print "It's a positive number - not necessarily an integer"; }