my @arr = qw( cool guy here );
my $str = "I am cool";
my $re = "(?:" . (join '|', map quotemeta, @arr) . ")";
if ($str =~ $re) { # if ($str =~ /^$re$/) {
print "Matched\n"; # print "Equals\n";
} # }
####
use Regexp::List qw( );
my @arr = qw( cool guy here );
my $str = "I am cool";
my $re = Regexp::List->new(@arr)->list2re();
if ($str =~ $re) { # if ($str =~ /^$re$/) {
print "Matched\n"; # print "Equals\n";
} # }
####
my @arr = qw( cool guy here );
my $str = "I am cool";
if (grep {index($str,$_)!=-1} @arr) { # if (grep {$str eq $_} @arr) {
print "Matched\n"; # print "Equals\n";
} # }