in reply to How can I find the occurrence of a variable in each line of an array
If not I'd just construct an "or"ed regex with all search terms.
DB<127> @search=qw/smith sanders/ => ("smith", "sanders") DB<128> $regex= join "|", @search => "smith|sanders" DB<129> @matches = grep { /($regex)/ } @full => ( "Bob-smith#anthropology", "Sandy-smith#sociology", "Tom-sanders#english", "Anthony-sanders#english", ) DB<130> @full => ( "Bob-smith#anthropology", "Sandy-smith#sociology", "Tom-sanders#english", "Tina-lacy#socialwork", "Anthony-sanders#english", )
improved code
BTW we appreciate if you post real code not just multiply broken pseudo stuff. :)
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
|
|---|