use POSIX 'isdigit'; if (isdigit($c)) { print "$c is a digit" }