in reply to Finding unique email addresses (was: Help!)
A quick-and-dirty fix could be to keep each "seen" email address as a key in a hash (which could get very large, but hey--).
This could get you going:
(this code is untested)
--twerq
This could get you going:
#!/usr/bin/perl use Email::Find; my %seen_emails; # this could get big! $file = shift; open (FILE, $file) or die "Couldn't open filename: "; while (<FILE>) { $text = $_; my $finder = Email::Find->new(sub { my($email, $orig_email) = @_; my $formatted_email = $email->format; if (!defined($seen_emails{$formatted_email})) { # remember we've seen this guy $seen_emails{$formatted_email} = 1; # and show this email addy print $formatted_email . "\n"; } return $orig_email; }); $finder->find(\$text);
(this code is untested)
--twerq
|
---|
In Section
Seekers of Perl Wisdom