#print "numeric" if $val is one character and it's a digit my $val = "3"; print "numeric\n" if($val =~ m/^\d$/);