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
In reply to Re: getting server names in the domain and looking up ips
by VSarkiss
in thread getting server names in the domain and looking up ips
by RayRay459
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |