in reply to Convering Perl socket program into CGI.

Just to address your second question:
"One more query what is the mechanism of doing $getdata = 'nslookup www.perlmonks.com'; (as in Linux)?"

There are several ways to approach this:

  1. You could use backticks (not really recommended as it is platform-specific):
    my $getdata = `/usr/bin/nslookup www.perlmonks.com`;
  2. You could use the built-in system1 function (also not particulary recommended):
    my $getdata = system("/usr/bin/nslookup www.perlmonks.com");
  3. Possibly the best option is to use another built-in function, gethostbyname2
    use Socket; my $ip = gethostbyname("www.perlmonks.com");
  4. One further option is the Net::Nslookup module. I've not used this one, so I can't really comment on it (although it does look quite simple).

1. There are all sorts of traps for the unwary with system, refer to the docs for more info.

2. gethostbyname when called in list context will return additional information - again, refer to the docs.

Hope this helps,
Darren :)