"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 gethostbyname("@_"));
>                                          ^^^^
> You should be using $_[0] here instead of "@_".  What you are doing is
> the same as join( $", @_ ).
>
>
> > }
> > $data = resolve("host.mask.com");
> >
> > However, if I give it an IP address, it will just return nothing, even
if
> > the IP address is resolvable. Is there as module to do this, or a set of
> > scripts?
>
> It works for me.  :-)
>
> $ 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 gethostbyname( $_[0] ) ) }
> print resolve( "216.239.51.101" );
> '
> 216.239.51.101

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
my point exactly, it resolves hosts to ips, but not vice versa, and i need
to know how to reverse resolve. i've had a look at the Net::hostent package
that was suggested to me, seems ok, yet to grasp with how it works, but if
there's a simpler solution, i'd like to know.

>
>
>
> John
> --
> use Perl;
> program
> fulfillment

Dan



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to