Howdy! I've spent some time reading about looking up a DNS in perl but am having trouble with my script. Hoping someone could give me a hint as to where I've gone wrong?
#!/usr/bin/perl-w use Socket; if ( $#ARGV != 0 ) { print "Usage: $0 hostname\n"; exit(1); } $userinput = $ARGV[0]; if ($userinput =~ m/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/ ) { $userinput = $ip; $hostname = gethostbyaddr(inet_aton($ip), AF_INET) or die "Can't R +esolve $ip: $!\n"; print $hostname; } else { $userinput = $name; $ipaddr = gethostbyname($name) or die "Can't resolve $name: $!\n"; $ipaddr = inet_ntoa(inet_aton($name)); print $ipaddr; } ##prints this? $ perl ddlookup.pl wbur.org Can't resolve : No such file or directory
In reply to DNS Lookup by jaldama
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |