in reply to comparing two arrays and displaying scalar matches

Unfortunately, this doe not seem to work any other ideas?

@array = <FILE>;<br> @pattern = <FILE2>;<br> foreach $line(@array)<br> {<br> if ($line =~ m/@pattern/)<br> }<br> print $line;<br> }<br> }

Replies are listed 'Best First'.
Re^2: comparing two arrays and displaying scalar matches
by ww (Archbishop) on Nov 30, 2010 at 19:25 UTC
    Ideas:
    1. use strict; use warnings; would have told you that the curly at line 6 faces the wrong way (is a close_curly, not the open required in an if... clause.
       
    2. Proofread, test anything you plan to post here with perl -c scriptname.
       
    3. Review the use of <c>...</c> (or <code>...</code>) tags at Markup in the Monastery. The HTML break tags don't belong inside code tags unless your code actually has <br> tags.