my $class = qr/[a-yA-Y]/; # Don't want to match z or Z if ($string =~ /^${class}+$/) { print "'$string' doesn't have a z in it!\n"; }