if ($newpasswd !~ /^[A-Za-z0-9]+$/) { #EXECUTE SOME THINGS; } #### if ($newpasswd !~ /^[\w\d]+$/) { #EXECUTE SOME THINGS; }