Re: Resolving IP's/Hostmasks

2003-01-23 Thread John W. Krahn
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

Re: Resolving IP's/Hostmasks

2003-01-23 Thread david
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"

Re: Resolving IP's/Hostmasks

2003-01-23 Thread dan
"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

Re: Resolving IP's/Hostmasks

2003-01-22 Thread John W. Krahn
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

Re: Resolving IP's/Hostmasks

2003-01-22 Thread simran
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

Resolving IP's/Hostmasks

2003-01-22 Thread dan
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