TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:20104] A perl problem



Hello Apu:

> I tried to use NET::DNS but as I am just using a web hosting from
> a company I am not able to use that module (they don't have it
> installed).
>
> Any other idea (using unix....)

#!/usr/bin/perl -w

use strict;

my ($name,$alias,$type,$net,@addrs) = gethostbyname("www.yahoo.com");

print qq[$name,$alias,$type,$net\n];
foreach my $addr (@addrs)
{
   my @bytes = unpack('C4',$addr);
   printf "   %s\n", join ".", @bytes;
}