From: "David Gray" <[EMAIL PROTECTED]> > > Change this line > > > > ($name, $aliases, $addrtype, $length, @addrs) = > > gethostbyname($host); > > > > To > > > > (undef, undef, undef, undef, @addrs) = gethostbyname($host); > > I think mine is prettier, at least (see below)... Is there a reason > why this might be considered "Better" than doing: > > @addrs = (gethostbyname($host))[4]; > > ?
Of course there is. Those two are different. Notice that the fifth variable in the list is not a scalar but an array. It is supposed to slurp all items starting with the fifth. While usually the gethostbyname() will return only one address it may return several. At least according to the docs. Example: sub foo { (0,1,2,3,4,5,6,6,8,9) }; (undef,undef,undef,undef,@a1) = foo(); @a2 = (foo())[4]; print join(", ", @a1),"\n"; print join(", ", @a2),"\n"; Jenda =========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ========== There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]