@arr=('cool','guy','here'); $str1="I am cool"; foreach my $tmp(@arr){ if($str1=~m/$tmp/){ print "Matched"; last; } } #### @arr=(cool,guy,here); $str1="I am cool"; if($str1 =~ m/@arr/){ print "Matched"; }