if ($num =~ /^[^\D1]\d+$/) { print "does not begin with a 1\n"; } #### if ($num =~ /^(?:[^\D1]|1\d)\d*$/) { print "not a 1\n"; }