Hi, Assuming @keywords and @list1 and @list2 you can use Array::Diff (http://search.cpan.org/~typester/Array-Diff-0.04/lib/Array/Diff.pm)
use Array::Diff; @list1 = qw/big bad blue ball/; @list2 = qw/box sand house/; @keywords = qw/brown black blue/; @list1 = sort(@list1); @list2=sort(@list2) @keywords=sort(@keywords); <code> my $diff = Array::Diff->diff( [EMAIL PROTECTED], [EMAIL PROTECTED] ); print "1\n" if $diff->count; $diff = Array::Diff->diff( [EMAIL PROTECTED], [EMAIL PROTECTED] ); print "2\n" if $diff->count; </code> This might give you a hint. Yaron Kahanovitch ----- Original Message ----- From: "yitzle" <[EMAIL PROTECTED]> To: "Perl Beginners" <[email protected]> Sent: 22:42:29 (GMT-0800) America/Tijuana שבת 19 מאי 2007 Subject: RegEx again I got two arrays of strings. I am trying to search to see if any of the strings of one array matches a string of the other array. Lists to search: qw/big bad blue ball/, qw/box sand house/ Search list: qw/brown black blue/ I should be able to get list #1 but not list #2 because the first list has "blue" as does the search list. # Look in @list1 = qw/big bad blue ball/; @list2 = qw/box sand house/; @keywords = qw/brown black blue/; # Add a ^ and $ so the strings match fully push @search, qr/^$_$/ for ( @keywords ); $searchRegEx = join '|',@search; print "1" if ( grep $searchRegEx, @list1 ); print "2" if (grep $searchRegEx, @list2); Result: "12" Um. Please help? Thanks! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
