my $namecnt = qr/^(David|Tom|Sam|Will|Dave|William|Thomas)$/; #### if ($word =~ /$namecnt/i) { #### my @words = split /:/;