in reply to @addrs = (gethostbyname('www.yahoo.com'))[4..-1] ?

#!/usr/bin/perl -- use strict; use warnings; use Net::hostent; use Socket; my @addrs = @{ gethostbyname('www.yahoo.com')->addr_list };

Replies are listed 'Best First'.
Re^2: @addrs = (gethostbyname('www.yahoo.com'))[4..-1] ?
by ikegami (Patriarch) on Nov 04, 2010 at 02:38 UTC
    That still uses an intermediate variable (not that I think it makes sense to request avoiding such).
      I don't understand how. I guess I have no idea what is an "intermediate variable"
        The new gethostbyname copies the values from gethostbyname into an array. addr_list returns that array variable. It's what's being dereferenced (@{}). (Only one of the 4 solutions I posted copy the returned values.)