in reply to Re: scripty email address regex stuff
in thread scripty email address regex stuff

Thanks, chromatic. You were right on both counts. mail::address is pretty easy to use, though the output is not coming out the way I'd hoped. Am I doing this right?
#!/usr/local/bin/perl use Mail::Address; my $file = shift; open (FILE, $file) or die "$@ Couldn't open file"; my @contents = <FILE>; foreach my $line (@contents) { my @addrs = Mail::Address->parse($line); foreach $addr (@addrs) { print $count++, $addr->address, "\n"; } }

I'm looking for just the address (and the count), but names, commas, and semicolons are coming out as individual results.