#!C:/perl/bin/perl.exe
use CGI;
$query = new CGI;
#
# Read in all ten scores from CGI packet (even if those items were not used)
#
$v01= $query->param('v01');
$v02= $query->param('v02');
$v03= $query->param('v03');
$v04= $query->param('v04');
$v05= $query->param('v05');
$v06= $query->param('v06');
$v07= $query->param('v07');
$v08= $query->param('v08');
$v09= $query->param('v09');
$v10= $query->param('v10');
#
# We're going to use the unrandomize array, @varlist, to store the names of the scores and the array @reversekey
# to represent which items will need to be reverse keyed
#
@varlist= ("v01", "v02", "v03", "v04", "v05", "v06", "v07", "v08", "v09", "v10");
@reversekey = (0,0,1,0,1,0,0,1,1,1);
print $query->header;
print $query->start_html(-title=>'Thank You');
# In this loop, we cycle through each item that could have been administered.
# For each item, we determine whether the item was administered by asking whether
# the response is between 1 and 5. (If it is not, then the item was not administered, or, at least, not responded to.)
# If the response exists, we add the response to our sum called $esteem. Notice that we only add the response
# for non-reverse keyed items. If the item is reverse keyed (i.e., if "if(reversekey[$i] == 1"), we subtract
# 6 from the response before adding it to $esteem. This process allows us to create a sum of all the responses
# for the items administered.
print "Note: This is the 'results' page for the challenge posed at the end of Chapter 7. I have printed the 'internal computations' to the screen (see below) so that you can get a better sense of how the program is working. I've also included detailed comments in the code itself.--Chris