次のように生成された概要から直接コピー/貼り付けします。
use strict;
use warnings;
use Net::WhoisNG;
my $w=new Net::WhoisNG('google.com');
if(!$w->lookUp()){
print "Domain not Found\n";
exit;
}
# If lookup is successful, record is parsed and ready for use
foreach my $type (qw(admin tech registrant bill)) {
my $contact=$w->getPerson($type);
if ($contact) {
print "$type\n";
my $email = $contact->getEmail();
if ($email and $email =~ /\S/) {
print "$email\n";
} else {
my $unparsed = join(' ', @{$contact->getCredentials()});
# Use an regexp to extract e-mail from freeform text here, you can even pick ready one somewhere here on SO
print "$unparsed\n";
}
print "----\n\n";
}
}
結果:
admin
dns-admin@google.com +1.6506234000 Fax: +1.6506188571
----
tech
dns-admin@google.com +1.6503300100 Fax: +1.6506181499
自由形式のテキストから電子メールを抽出する演習はお任せします。