title: search large file for an array of IP addresses
body: <p>I have a large network file of about 400MB. I have an array of about 11 IP addresses.</p>
  <p>I need to search the entire file for these 11 IP addresses but my Perl script is not working. I have put the ip addresses in an array but I'm not sure if I want to open the file for each element of the array or vice versa.</p>
  <pre><code>#!/usr/bin/perl
  use warnings;
  use strict;
  
  my @leaflogicservers = qw/
  xx.117.189.181
  xx.117.191.238
  xx.117.185.80
  xx.117.184.255
  52.xxx.52.29
  52.xxx.52.183
  52.xxx.52.184
  52.xxx.52.185
  52.xxx.52.186
  40.xxx.190.72
  40.xxx.11.156
  /;
  
  my $PathToFile = 'router01.log';
  
  open my $router01, '&lt;', &quot;$PathToFile&quot; or die $!;
  
  
  while ( my $ip = &lt;$router01&gt; ) {
  chomp($ip);
  for my $catch ( @leaflogicservers ) {
  chomp($catch);
  
  
  if ( $catch =~ m/$ip/ ) {
  print &quot;Caught!\n&quot;;
  }
  }
  }
  </code></pre>