Help for this page
$words = join '|' => @A; if (grep /\b(?:$words)\b/, @B) { # do this } else { # do that }