my @needles = ("1-2 Steps", "5-7 Steps", "8-10 Steps", "catch"); my @haystacks = ("move 1-2 steps", "move 8-10 steps to hoist", "catch the ball"); for my $needle (@needles) { my $found; my $needle_regex = quotemeta $needle; for my $haystack (@haystacks) { if ($haystack =~ /$needle_regex/i) { print "
"; print "Found [$needle] in [$haystack]\n"; print "
"; $found++; } } if (!$found) { print "
"; print "Couldn't find [$needle] anywhere!\n"; print "
"; } }