From: John D Groenveld Date: Tue, 6 May 1997 17:41:12 +0000 (-0400) Subject: perlfaq9, hostname X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bfd13ef816abf16369321d26f2f63772eff5cd21;p=p5sagit%2Fp5-mst-13.2.git perlfaq9, hostname Simple patch... p5p-msgid: 199705061741.NAA22777@cse.psu.edu --- diff --git a/pod/perlfaq9.pod b/pod/perlfaq9.pod index f4f4759..d7faca0 100644 --- a/pod/perlfaq9.pod +++ b/pod/perlfaq9.pod @@ -295,7 +295,7 @@ give you the hostname after which you can find out the IP address use Socket; use Sys::Hostname; my $host = hostname(); - my $addr = inet_ntoa(scalar(gethostbyname($name)) || 'localhost'); + my $addr = inet_ntoa(scalar(gethostbyname($host || 'localhost'))); Probably the simplest way to learn your DNS domain name is to grok it out of /etc/resolv.conf, at least under Unix. Of course, this