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
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]