in reply to How to Ignore an email address with this script.

If you don't want to parse the email address yourself, visit CPAN and fetch Net::ParseWhois.
#!/usr/bin/perl -w use strict; use Net::ParseWhois; # also see Net::Whois my $dom = 'domain.com'; my $w = Net::ParseWhois::Domain->new($dom); unless ($w->ok) { warn "error: " . $w->{'error'} . "\n" if $w->{'error'}; die "No whois match for $dom\n"; } my $c = $w->contacts; # or BILLING or TECHNICAL my $email = (split / / => $c->{ADMINISTRATIVE}[0])[-1]; unless ( index( $email, '@' ) > -1 ) { ($email = $c->{ADMINISTRATIVE}[-1]) =~ s/^Email: //; } print "administrative email address: $email\n";

--sacked

Replies are listed 'Best First'.
Re: (sacked) Re: How to Ignore an email address with this script.
by dru145 (Friar) on Nov 17, 2001 at 01:49 UTC
    sacked,

    Thanks for the suggestion, but neither Net::Whois or Net::ParseWhois can retrieve records by ip address which is what I need to do. I failed to mention that this script is part of a larger script that parses firewall log files for dropped traffic, creates an abuse email from a template, obtains the email address (from the above code), includes a snipet of log file for evidence, and sends it on its merrily way. It has been working really well except for this little issue. I would post the entire script, but it is 300 lines long and I've learned if you post too much code to perlmonks, most monks won't reply.

    -Dru