$ perl -e 'print "Matched.\n" if "foo8baz" =~ /[0-9]/;' Matched. $ perl -e 'print "Matched.\n" if "foobaz" =~ /[0-9]/;'