in reply to getting server names in the domain and looking up ips

Well, getting rid of the $ isn't too bad. Just nail it after you read in the list. (TIMTOWTDI, but this is simple and effective):

my @computers = grep { /\$$/ } @users; s/\$$// foreach @computers; # remove trailing $ @computers = join("\n",@computers);

As for gethostbyname, it returns an array of IP addresses for the hostname (remember, there may be more than one). An easy way to cope is to move the elements you want using perlfunc:splice:

@addr = gethostbyname($hostname); # note: an array now splice(@addr, 0, 4); # get rid of other stuff foreach (@addr) { print OUT join('.', unpack('C4', $_)), "\n"; }

HTH

Replies are listed 'Best First'.
Re: Re: getting server names in the domain and looking up ips
by RayRay459 (Pilgrim) on Aug 08, 2001 at 00:36 UTC
    i made some of the changes that you suggested and it still doesn't work. I am still getting the $ after the server names. and the ip stuff is returning my own ip address. Any help is appreciated. Thanks again, Ray