if (/^[:alpha:]+/) { print "string is alpha"; } elsif (/^[:digit:]+/) { print "string is digits" } else { print "sting is weird stuff"; }