in reply to POSIX-Style character classes

Perhaps you want:
perl -e 'if("42"=~ /^[[:digit:]]+$/) {print "42 is a digit\n"} else {p +rint "42 is not a digit\n"};'
the inner [] is part of the charclass name. And do not mix ' and " for oneliners. Just start with ' and use " or q or qq in your oneliner on UNIX.
Boris