#!C:/perl/bin/perl.exe
use CGI::Carp qw(fatalsToBrowser);
use CGI;
$query = new CGI;
# Demo for loop to access elements in an array - questionnaire application
# Prepare to send HTML code to browser
print $query->header;
print $query->start_html(-title=>'Thank You');
# Store the questionnaire items as separate elements of an array
@items = ("I feel that I'm a person of worth, at least on an equal plane with others.","I feel that I have a number of good qualities.","All in all, I am inclined to feel that I am a failure.","I am able to do things as well as most other people.","I feel I do not have much to be proud of.");
# One way to do it
print "One way to do it (see Perl code)
";
@variables = ("v01","v02","v03","v04","v05");
# Loop through items
for($i = 0; $i <= 4; ++$i){
$itemNumber = $i+1;
print "$itemNumber. $items[$i]
";
print "Strongly Disagree";
print "";
print "";
print "";
print "";
print "";
print "Strongly Agree
";
}
# Another way to do it
print "