in reply to Re: Using the 'if' statement...
in thread Using the 'if' statement...
my $pattern = join '|', map quotemeta, @countries; if ($country =~ /^(?:$pattern)$/) { print "True\n" }
Or even
my ($pattern) = map qr/^(?:$_)$/, join '|', map quotemeta, @countries; if ($country =~ $pattern) { print "True\n" }
|
|---|