in reply to Compare two lists of words
short question, short answer:
my @words = qw/foo bar/; #your @A my @strings = <DATA>; #your @B my $contains = 0; # a boolean { my $words = join '|',map quotemeta,@words; for(@strings){ ++$contains and last if /$words/; } } print $contains ? 'yes' : 'no' , "\n" __DATA__ abc def ghi foo jkl mno
To get a better answer: what does "array @B contains the words in array @A" mean? In which case is this fullfilled? I have assumed that one element of @B must contain one element of @A...
--
|
|---|