#!/usr/bin/perl
use strict;
use warnings;
my @arr=('cool','guy','here');
my $str1="I am cool";
if($str1 =~ m/@arr/){
print "Matched";
}
####
$ perl -MO=Deparse test.pl
use warnings;
use strict 'refs';
my(@arr) = ('cool', 'guy', 'here');
my $str1 = 'I am cool';
if ($str1 =~ /@arr/) {
print 'Matched';
}
test.pl syntax OK
####
#!/usr/bin/perl
use strict;
use warnings;
my @arr=('cool','guy','here');
my $joined_rx = join( '|', map { quotemeta($_) } @arr );
my $str1="I am cool";
if ($str1 =~ m/$joined_rx/) {
print "Matched";
}