use Scalar::Util 'looks_like_number'; if (0 != substr($var,0,1) and looks_like_number($var)) { # it's a number }