i need to find a match from array which contains a word to be matched in another array below is the code i have done so far
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;
for my $haystack (@haystacks) {
if ($haystack =~ /\i\Q$needle\E\i/) {
print "<br>";
print "Found [$needle] in [$haystack]\n";
print "</br>";
$found++;
}
}
if (!$found) {
print "<br>";
print "Couldn't find [$needle] anywhere!\n";
print "<br>";
}
}
this code only matches the exact string