I would say it would be best to have just one perl program to make it easier to save the state of the variables across the form; you could have a function that would find the next question by a call like this: ask_question(@answers_so_far). The @answers_so_far variable would just be an array of the current answers, in any format suitable for your program(a suggestion, though I don't know the input, questions, etc., would be for the element to be like this "1:a" for question one, answer a, to make an easy split, though you could have parallel arrays, or even a hash for something similar, TIMTOWTDI). You asked, aslo:
if so how do I go about saving all the variables

Well, in the one-script example, you could just have a global array(or whatever you are storing the answers in), and other variables global as mandated by the problem. However, if you mean that you want to save them for each user, consider using cookies, or a variety of other methods(described in O'Rielly's CGI/PERL book, and across countless nodes, I suspect, on this site).

I hope I've answered the question sufficiently, if not just ask again.

UPDATE: I forgot to mention(though as sifmole said) check out some of the modules on CPAN, and read CGI.pm's docs for form generation tips, etc.


In reply to Re: generarting dynamic html using perl by dimmesdale
in thread generarting dynamic html using perl by new_2_perl

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.