in reply to Re: comparing two arrays and displaying scalar matches
in thread comparing two arrays and displaying scalar matches

What background do you have in programming? I mean this with respect - it seems like you are currently trying to tackle a problem which is beyond your current understanding. For example,

We are glad to help neophytes learn the language, and will do our best to guide your development. I would strongly suggest you either take a course or get a good reference book, such as Programming Perl, Third Edition.

While some significant optimizations have been suggested above, the simplest code which seems to conform to what you expect might look something like:

foreach $line (@array) { foreach $pat (@pattern) { if ($line =~ m/$pat/) { print $line; } } }

This might not behave as you expect, depending on what is in your @patterns array - see perlretut for some introductory material on regular expressions.