Hi all.

I'm writing a small opinion poll using perl/cgi and it appears I need a little assistance. See below for code:

#!c:\perl\bin\perl.exe -wT use strict; use CGI qw(:standard); my $line; my %survey; print header; open( FH, ">>psy.txt") or die "Error : $!\n"; foreach my $key( param() ) { print FH param($key), "\n"; } close FH; open( FH, "<psy.txt" ) or die "Error : $!\n"; while( $line = <FH> ) { $survey{$line}++; } foreach my $key ( keys %survey ) { print table(Tr(td( { -width => "$survey{$key}", -height => "30", -bgcolor => "red" } ) ) ), br; } close FH;


The HTML form consists of 15 questions. Each question can be answered via one of four radio buttons. In an attempt to simplify the design aspects, I followed davido's advice and used unique 'id' numbers (starting with 1 and ending with 60). Question 1 is 1..4, question 2 is 5..8, etc. These are written to a small text file then placed into a hash in order to generate a small histogram (via CGI.pm). I'd like to display the output in the following manner:



Note:This is *not* a homework assignment. It is a favor for a psychology professor.

Thanks,
-Katie.

In reply to Writing an opinion poll in perl. by DigitalKitty

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.