On Sun, 2007-05-20 at 01:42 -0400, yitzle wrote: > # 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);
Problem is you need slashes. print "2" if (grep /$searchRegEx/, @list2); I also wonder why you did not use the simpler: $searchRegEx = '^('. join( '|',@keywords ). ')$'; -- Ken Foskey FOSS developer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/