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 :)


In reply to Re: Convering Perl socket program into CGI. by McDarren
in thread Convering Perl socket program into CGI. by rockmountain

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.