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