use Scalar::Util; use warnings; $string = '5.' . '0' x 30 . '1';; print $string, "\n"; if(Scalar::Util::looks_like_number($string) && $string > 0 && $string == int($string) ) { print "looks like a positive integer\n"; } else {print "not a positive integer\n"} __END__ Outputs: 5.0000000000000000000000000000001 looks like a positive integer