|
不知道怎么错,请指正!
#!/usr/bin/perl -w
use strict;
use Socket;
my $address_pat= '^/d+\.\d+\.d+\.d+$';
while (<>) {
chomp;
die "$_: Not a valid address" unless /$address_pat/o;
my $name=gethostbyaddr (inet_aton($_),AF_INET);
$name ||= '?' ;
print "$_ => $name\n";
}
运行:
# perl name_trans.pl <address
202.96.103.252: Not a valid address at name_trans.pl line 7, <> chunk 1.
这样也不行,WHY ??
#!/usr/bin/perl -w
my $address= "202.96.103.252";
my $name=gethostbyaddr( inet_aton($address) , AF_INET);
print "$name\n";
|
|