Addition to: How do I find out my hostname/domainname/IP address?

[email protected]
Newsgroups perl.perlfaq.workers
Organization Chez Inwap
Message-ID <[email protected]>
> 9.23: How do I find out my hostname/domainname/IP address?
>
>        my $addr = inet_ntoa(scalar gethostbyname($host || 'localhost'));

If the host name is not important, that can be simplified to:

	my $addr = join(".", unpack C4,((gethostbyname "")[4]));
-- 
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.