>>>>> "Brian" == Brian D Foy <[EMAIL PROTECTED]> writes:

Brian> In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
Brian> wrote:

>> > 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]));


Brian> i've added this to my queue of things to catch up on.  i'm on
Brian> holiday at the moment, so don't expect anything soon. :)

Didn't work when I just tried it (OS X 10.2.3, airport connection).
Perhaps it's peculiar to some net setups and not others, or some Unix
flavors and not others.  In any case, it should be noted that it's not
portable.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Reply via email to