title: check if a pattern exist in a file
body: <p>i have a very simple perl question regarding pattern matching problem.
  I am reading file with a list of names (fileA).
  I would like to check if any of these names exist in another file (fileB).</p>
  
  <pre><code>if ($name -e $fileB){
      do something
  }else{
      do something else
  }
  </code></pre>
  
  <p>it is in a way to check if a pattern exists in a file.
  I have tried</p>
  
  <pre><code>open(IN, $controls) or die "Can't open the control file\n";
      while(my $line = &lt;IN&gt;){
              if ($name =~ $line ){
                      print "$name\tfound\n";
              }else{
                      print "$name\tnotFound\n";
              }
      }
  </code></pre>
  
  <p>This is repeating itself as it checks and prints every entry rather than checking whether the name exists or not.</p>