Hi all, I have a small question regarding the processing of variables that come to my script via the web (using the cgi.pm module to parse and access item elements).
I have created an online form for my father's doctoral research to process the answers he's received as he gets them. The form returns around 80 1-character digits (1-6, depending on agreement or disagreement) with associated keys (q1_1, q1_2 etc. So far my script puts every form item in to it's own variable, and calls upon that variable when it is writing the tab-delimited file (which will be used in Exel or SPSS etc for data analysis. Is there an easier way to do this than I have? -------------------------------------- #!/usr/bin/perl -w use CGI qw(:standard); my $q1_1 = param("q1_1"); my $q1_2 = param("q1_2"); my $q1_3 = param("q1_3"); my $q1_4 = param("q1_4"); my $q1_5 = param("q1_5"); my $q1_6 = param("q1_6"); my $q1_7 = param("q1_7"); my $q1_8 = param("q1_8"); my $q1_9 = param("q1_9"); my $q1_10 = param("q1_10"); my $q1_11 = param("q1_11"); my $q1_12 = param("q1_12"); my $q1_13 = param("q1_13"); my $q1_14 = param("q1_14"); my $q1_15 = param("q1_15"); my $q1_16 = param("q1_16"); my $q1_17 = param("q1_17"); my $q1_18 = param("q1_18"); my $q1_19 = param("q1_19"); my $q1_20 = param("q1_20"); my $q1_21 = param("q1_21"); my $q1_22 = param("q1_22"); my $q1_23 = param("q1_23"); my $q1_24 = param("q1_24"); my $q1_25 = param("q1_25"); my $q1_26 = param("q1_26"); my $q1_27 = param("q1_27"); my $q1_28 = param("q1_28"); my $q1_29 = param("q1_29"); my $q1_30 = param("q1_30"); my $q1_31 = param("q1_31"); my $q1_32 = param("q1_32"); my $q1_33 = param("q1_33"); my $q1_34 = param("q1_34"); my $q1_35 = param("q1_35"); my $q1_36 = param("q1_36"); my $q1_37 = param("q1_37"); my $q1_38 = param("q1_38"); my $q1_39 = param("q1_39"); my $q1_40 = param("q1_40"); my $q1_41 = param("q1_41"); my $q1_42 = param("q1_42"); my $q1_43 = param("q1_43"); my $q1_44 = param("q1_44"); my $q1_45 = param("q1_45"); my $q1_46 = param("q1_46"); my $q1_47 = param("q1_47"); my $q1_48 = param("q1_48"); my $q1_49 = param("q1_49"); my $q1_50 = param("q1_50"); my $q1_51 = param("q1_51"); my $q1_52 = param("q1_52"); my $q1_53 = param("q1_53"); my $q1_54 = param("q1_54"); my $q1_55 = param("q1_55"); my $q1_56 = param("q1_56"); my $q1_57 = param("q1_57"); my $q1_58 = param("q1_58"); my $q1_59 = param("q1_59"); my $q1_60 = param("q1_60"); my $q1_61 = param("q1_61"); my $q1_62 = param("q1_62"); my $q1_63 = param("q1_63"); my $q1_64 = param("q1_64"); my $q1_65 = param("q1_65"); my $q1_66 = param("q1_66"); my $q1_67 = param("q1_67"); my $q1_68 = param("q1_68"); my $q1_69 = param("q1_69"); my $q1_70 = param("q1_70"); my $q1_71 = param("q1_71"); my $q7_1 = param("q7_1"); my $q7_2 = param("q7_2"); my $q7_3 = param("q7_3"); my $q7_4 = param("q7_4"); my $q7_5 = param("q7_5"); my $q7_6 = param("q7_6"); my $q7_7 = param("q7_7"); my $q7_8 = param("q7_8"); my $q7_9 = param("q7_9"); open(COUNTER,"entrycount.txt"); while(<COUNTER>){ $entrynumber = $_; ###get previous entry number last; } close(COUNTER); open(COUNTER,">entrycount.txt"); $entrynumber++; ###add one to it print COUNTER "$entrynumber"; ###write the new value to file ###and close it again for next time close(COUNTER); open(OUTFILE,">>tabdelimited.txt"); #open the final file #write the tab-delimited results to it print OUTFILE "$entrynumber\t$q1_1\t$q1_2\t$q1_3\t$q1_4\t$q1_5\t$q1_6\t$q1_7\t$q1_8\t$q1_9 \t$q1_10\t$q1_11\t$q1_12\t$q1_13\t$q1_14\t$q1_15\t$q1_16\t$q1_17\t$q1_18\t$q 1_19\t$q1_20\t$q1_21\t$q1_22\t$q1_23\t$q1_24\t$q1_25\t$q1_26\t$q1_27\t$q1_28 \t$q1_29\t$q1_30\t$q1_31\t$q1_32\t$q1_33\t$q1_34\t$q1_35\t$q1_36\t$q1_37\t$q 1_38\t$q1_39\t$q1_40\t$q1_41\t$q1_42\t$q1_43\t$q1_44\t$q1_45\t$q1_46\t$q1_47 \t$q1_48\t$q1_49\t$q1_50\t$q1_51\t$q1_52\t$q1_53\t$q1_54\t$q1_55\t$q1_56\t$q 1_57\t$q1_58\t$q1_59\t$q1_60\t$q1_61\t$q1_62\t$q1_63\t$q1_64\t$q1_65\t$q1_66 \t$q1_67\t$q1_68\t$q1_69\t$q1_70\t$q1_71\t$q7_1\t$q7_2\t$q7_3\t$q7_4\t$q7_5\ t$q7_6\t$q7_7\t$q7_8\t$q7_9\n"; close(OUTFILE); print "Content-Type: text/html\n\n"; ###HTML page asking "Do you want to ###enter another questionnaire ###result, or view raw data so far? print '<P><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="550"><TR><TD><CENTER><H3><BR>Entry #'."$entrynumber".' successfully entered.<BR></H3><H3>Please choose from selection below:</H3><H3><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%"><TR><TD WIDTH="48%"><P ALIGN="RIGHT"><A HREF="../submit.html"><IMG SRC="submit.gif" WIDTH="188" HEIGHT="141" ALIGN="BOTTOM" BORDER="0"></A></TD><TD WIDTH="20"> </TD><TD WIDTH="48%"><A HREF="tabdelimited.txt"><IMG SRC="viewdata.gif" WIDTH="188" HEIGHT="141" ALIGN="BOTTOM" BORDER="0"></A></TD></TR></TABLE></CENTER></TD></TR></TABLE>'; ------------------------------------------------------ Thanks! -Shannon Murdoch -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]