#!/usr/bin/perl -w print "Content-type:text/html\n\n"; print "Survey Results\n"; print "\n"; open(INF,"FlatFile.out") or dienice("Couldn't open FlatFile.out for reading: $! \n"); @data = ; close(INF); # First we initialize some counters and hashes for storing the # summarized data. $NumberOfRecords = 0; $Comment1 = ""; # Variables can not start with numbers - pl - Pick List %pl1A_counts = (); %pl1B_counts = (); %pl1C_counts = (); %pl1D_counts = (); %pl1E_counts = (); %Q2_counts = (); %Q3_counts = (); %Q4_counts = (); %Q5_counts = (); %Q6_counts = (); # The following needs 1 variable per input field foreach $i (@data) { chomp($i); ($pl1A, $pl1B, $pl1C, $pl1D, $pl1E, $Q2, $Q3, $Q4, $Q5, $Q6, $Comment) = split(/\|/,$i); $NumberOfRecords++; # The following appends "$comments\n" to the end of the # $Commentx strings. # The .= construct is just a way to concatenate strings. $Comment1 .= "$Comment\n
"; # Each part of question 1 has 5 possible responses $pl1A_counts{$pl1A}++; $pl1B_counts{$pl1B}++; $pl1C_counts{$pl1C}++; $pl1D_counts{$pl1D}++; $pl1E_counts{$pl1E}++; # Questions 2-6 have 5 possible responses $Q2_counts{$Q2}++; $Q3_counts{$Q3}++; $Q4_counts{$Q4}++; $Q5_counts{$Q5}++; $Q6_counts{$Q6}++; # @invlist = split(/,/,$boxes); # foreach $j (@invlist) { # $involved{$j}++; # } } # End of foreach loop # Now we can print out a web page summarizing the data. print <

PARENT NEEDS ASSESSMENT SURVEY

Data compiled from $NumberOfRecords evaluations.

In order of importance, what areas would you rank the greatest needs are at Osbourn Park?
(1 by the greatest need)

\n"; print " \n"; for (my $i=5; $i>0 ; $i--) { print " \n"; $count1 += $Array1{$i}; $sum1 += $Array1{$i} * $i; } print " \n"; # print " \n"; print "\n"; } sub row_5_1_is_best { # The * says to accept a pointer local($String1, *Array1) = @_; local $count1 = 0; local $sum1 = 0; print "\n"; print " \n"; for (my $i=1; $i<6 ; $i++) { print " \n"; $count1 += $Array1{$i}; $sum1 += $Array1{$i} * $i; } print " \n"; # print " \n"; print "\n"; }
 
  1 2 3 4 5 N/A
EndHTML row_5_1_is_best("A. Student Prep for SOLS", *pl1A_counts); row_5_1_is_best("B. Family Friendly Atmosphere", *pl1B_counts); row_5_1_is_best("C. Facility Improvements", *pl1C_counts); row_5_1_is_best("D. Technology Exposure & Use", *pl1D_counts); row_5_1_is_best("E. Student Test Results (SAT, PSAT, AP, Etc...)", *pl1E_counts); print <

In the following questions, 5 means agree, 1 means disagree.

 
  5 4 3 2 1 N/A
EndHTML3 # row_5("Some string", *d); # Array reference using typeglob method row_5("I feel well informed about happenings, activities, and programs.", *Q2_counts); row_5("I feel satisfied with the educational programs offered at Osbourn Park.", *Q3_counts); row_5("I feel my child is safe at school.", *Q4_counts); row_5("I feel Osbourn Park is adequately serving my child’s educational, social and emotional needs.", *Q5_counts); row_5("I feel Osbourn Park is preparing my child for post-secondary work/education.", *Q6_counts); print <

Additional Comments

$Comment1

EndHTML4 # Start of subroutines sub dienice { my($msg) = @_; print "

Error

\n"; print $msg; print "\n"; exit; } sub row_5 { # The * says to accept a pointer local($String1, *Array1) = @_; local $count1 = 0; local $sum1 = 0; print "
$String1 $Array1{$i} $Array1{\"\"} $count1
$String1 $Array1{$i} $Array1{\"\"} $count1