You have explained a bit about what you don't want but you haven't said much about what you do want, so I can only guess. Anyway, you seem to be having a problem accessing CGI parameters from your script. Here is one simple way to access a CGI parameter:

use strict; use warnings; use Net::DNS; use CGI; use CGI::Carp qw{fatalsToBrowser}; my $q = CGI->new(); my $dns = new Net::DNS::Resolver; if(my $domain = $q->param('domain')) { my $mx = $dns->query( $domain, 'MX' ); print "content-type:text/html; charset=utf-8\n\n"; print "$domain:\n\n"; foreach my $rr ($mx->answer) { print "<br />", $rr->exchange, ' [<b>', $rr->preference, "</b> +]\n"; } } else { die "missing required parameter: domain"; }

If you query this CGI script with a URL like:

http://mydomain.tld/dnsdig.cgi?domain=google.com

You should get something.

It is unusual, in my experience, to use unnamed parameters with HTTP requests. Whether using GET or POST, I always name my parameters. Note that this CGI script will work with both GET requests, with parameters in the URL or POST requests with parameters in the body, as commony submitted from HTML forms.

Hopefully, this will get you past your block, to see how query parameters can be accessed from within a CGI script.

Do read up on CGI and CGI::Carp


In reply to Re: How to convert an @ARGV to form based input? by ig
in thread How to convert an @ARGV to form based input? by taint

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.