title: Validate email address from a text file?
body: <p>Im trying to search through a text file and find the valid email addresses.  Im doing something like this:</p>
  
  <pre><code>    #!/usr/bin/perl -w
  
  my $infile = 'emails.txt';
  
      open IN, "&lt; $infile" or die "Can't open $infile : $!";
  
      while( &lt;IN&gt; )
      { 
          if ($infile =~ /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6}$/) 
          { 
              print "Valid \n"; 
          } 
      }
  
      close IN;
  </code></pre>
  
  <p>But it doesnt do anything, any help?</p>