in reply to Re^4: Word Count and Match
in thread Word Count and Match
^ matches at the beginning, $ matches at the end.my $namecnt = qr/^(David|Tom|Sam|Will|Dave|William|Thomas)$/;
The match will now look like (I removed the /o as it's not recommended)
if ($word =~ /$namecnt/i) {
Note that the first argument to split is a regex. It's clearer to write
my @words = split /:/;
|
|---|