The feasibility of this depends totally on the nature of the CGI script you're wanting to call by hand. CGI scripts by their nature expect to be called from a web server, expect their arguments to provided per CGI spec, and will provide CGI output. The script.pl?argument construct is a web/CGI thing, but since you're trying to call your script via standard system() methods, CGI methods don't apply. Fortunately, the "GET" method you're using makes it easy:
system("./1.pl filename.txt"); # to stdout, or: my $output = `./1.pl filename.txt` # in $output
A security note: If, instead of using "filename.txt", you use a user-provided variable, make SURE your script uses taint-checking (-T argument, see perlsec) and un-taint the variable smartly before attempting to use it, or someone can easily put in a filename of "/etc/passwd" or "some.file;rm -rf /etc/httpd|", for example.

Since the script is a CGI script, its output will contain CGI headers. If this is OK, great. Otherwise, you will need to strip them out.

Perhaps you should consider an ASP technique for running a CGI script "within" the context of a page (with SSI this is called a "virtual include").

Hope this helps.


In reply to RE: RE: Re: Newbie Question by Fastolfe
in thread Newbie Question by Anonymous Monk

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.