If you're going the Perl CGI route, consider using the CGI module (sorry, chromatic).

If I understand your question correctly, you want a separate CGI script and a resulting html document. That is, instead of a dynamically-created html document, you'd like a static html document created by the script.

This can certainly be done, by writing the results to an html file, and then redirecting the browser to that file. You'd need write permissions for both the dir and file you're writing to. But now it gets a little messy...

You'd need to create a unique filename for each response--for each new htnl document that the CGI script creates. Additionally, you'd need to figure a way to deal with all the html files that your CGI script is creating. Do you leave them in the directory? If you're going to delete them, how long after they're created and how often?

You need to answer for yourself whether creating static html files from a CGI script is better than creating the pages 'on the fly,' as your script above does.


In reply to Re: How to display output in separate html form in cgi script by Kenosis
in thread How to display output in separate html form in cgi script by manmanda

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.