On Thu, 7 Feb 2002, Jesse Ahrens wrote:

> The gethostbyname() function returns 5 variables, the last on addrs is an
> array. How do I specify the function to only return that array rather than
> the 4 strings and 1 array?

gethostbyname() returns a list.  You can coerce that list to become an
array and then just grab that last element:

my @addresses = (gethostbyname($hostname))[4];

foreach (@addresses) {
        print join('.', unpack('C4',$_)), "\n";
}

-- Brett

                                          http://www.chapelperilous.net/
------------------------------------------------------------------------
        Why are you doing this to me?
        Because knowledge is torture, and there must be awareness before
there is change.
                -- Jim Starlin, "Captain Marvel", #29


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to