if ($goodguesses && ($whatever =~ /[$goodguesses]/) {...}