troubleshooting Question

Perl Cotains

Avatar of thomaszhwang
thomaszhwangFlag for United States of America asked on
6 Comments3 Solutions178 ViewsLast Modified:
I have a sentence x and I have a list of words.  I want to test if any of the words is in the sentence.  Can I test as follow?  Thanks.

for($i = 0; $i < $#words; $i++) {
if($sentence =~ $words[$i]) {
      //There is a match!
Join our community to see this answer!
Unlock 3 Answers and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros