my $str = "1"; if ($str =~ m/-?\p{Nd}/){ print "Matches\n"; else { print "Doesn't match\n"; }