Dan wrote:
>
> "John W. Krahn" <[EMAIL PROTECTED]> wrote in message
> >
> > $ perl -le'
> > use Socket;
> > sub resolve { inet_ntoa( scalar gethostbyname( $_[0] ) ) }
> > print resolve( "www.google.com" );
> > '
> > 216.239.51.101
> > $ perl -le'
> > use Socket;
> > sub resolve { inet_ntoa( scalar
Dan wrote:
>
> i've had a look at the Net::hostent
> package that was suggested to me, seems ok, yet to grasp with how it
> works
>
Net::hostent is easy to use:
#!/usr/bin/perl -w
use strict;
use Net::hostent qw(gethost);
my $h = gethost('216.239.51.101');
if($h){
print $h->name,"\n"
"John W. Krahn" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Dan wrote:
> >
> > Hey
>
> Hello,
>
> > I need a method that resolves Hostmasks into IP's, and IP's into hosts.
I
> > can do the former, with:
> >
> > sub resolve {
> > return inet_ntoa(scalar geth
Dan wrote:
>
> Hey
Hello,
> I need a method that resolves Hostmasks into IP's, and IP's into hosts. I
> can do the former, with:
>
> sub resolve {
> return inet_ntoa(scalar gethostbyname("@_"));
You should be using $_[0] here instead of "@_". What
Try the function: gethostbyaddr
or you could use:
http://search.cpan.org/author/JHI/perl-5.8.0/lib/Net/hostent.pm
On Thu, 2003-01-23 at 13:21, dan wrote:
> Hey
>
> I need a method that resolves Hostmasks into IP's, and IP's into hosts. I
> can do the former, with:
>
> sub resolve {
> return
Hey
I need a method that resolves Hostmasks into IP's, and IP's into hosts. I
can do the former, with:
sub resolve {
return inet_ntoa(scalar gethostbyname("@_"));
}
$data = resolve("host.mask.com");
However, if I give it an IP address, it will just return nothing, even if
the IP address is reso