in reply to scripty email address regex stuff

I think you mean while and not if, since there's a loop in the former and not in the latter. You might have more luck with the Mail::Address module, though.

Replies are listed 'Best First'.
Re: Re: scripty email address regex stuff
by mkahn (Beadle) on Oct 15, 2003 at 22:50 UTC
    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.