Ricardo Cumberbatch L. [mailto:[EMAIL PROTECTED]]
> I want to do somethin like this:
> 
> execute de nslookup comand
> # nslookup
> 
> then when this execute pass this
> 
> server domain
> 
> How can I do some thin like this, execute a program them pass it some
> parameter to it.

There are at least three ways to do this.

1. Use the nslookup command line, not the interactive mode:

  $response = `nslookup $host $server`;

2. Use the perl module Net::DNS instead of nslookup:

  use Net::DNS;
  $res = new Net::DNS::Resolver;
  $query = $res->search($host);
  if ($query) {
      foreach $rr ($query->answer) {
          next unless $rr->type eq "A";
          print $rr->address, "\n";
      }
  }
  else {
      print "query failed: ", $res->errorstring, "\n";
  }

3. Use Net::Telnet to interact with nslookup. Avoid doing it this way unless
you absolutely require interactive mode.

--
Mark Thomas                    [EMAIL PROTECTED]
Sr. Internet Architect         User Technology Associates, Inc.

$_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; ;y;y; ;;print;;
_______________________________________________
Perl-Unix-Users mailing list. To unsubscribe go to 
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users

Reply via email to