#!C:/perl/bin/perl.exe use CGI::Carp qw(fatalsToBrowser); use CGI; $query = new CGI; # Read in the responses to each item and save those responses locally $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'); $v01= $query->param('v09'); $v02= $query->param('v10'); $v11= $query->param('v11'); $v12= $query->param('v12'); $v13= $query->param('v13'); $v14= $query->param('v14'); $v15= $query->param('v15'); $v16= $query->param('v16'); $v17= $query->param('v17'); $v18= $query->param('v18'); $v19= $query->param('v19'); $v20= $query->param('v20'); $pass= $query->param('pass'); if($pass < 1){ $pass=0; } # get date and time ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $year = 1900 + $year; $mon= $mon+1; $hour = $hour - 1; $date1= "$mon/$mday/$year"; $date2= "$hour:$min:$sec"; print $query->header; print $query->start_html(-title=>'Survey about your former relationship'); if($pass == 3){ # Create a relationship length variable $rellength = (($v05*12) + $v06); # Create a composite score (average the responses to all the items) $disgust = ((6-$v15) + $v16 + $v17 + (6-$v18) + $v19 + $v20)/6; # Round the score to 2 decimal places and assign it a new variable name $disgust = sprintf("%.2f", $disgust); # Composite score for short relationships if($rellength <= 12){ $disgustshort = ((6-$v15) + $v16 + $v17 + (6-$v18) + $v19 + $v20)/6; $disgustshort = sprintf("%.2f", $disgustshort); } # Composite score for long relationships if($rellength > 12){ $disgustlong = ((6-$v15) + $v16 + $v17 + (6-$v18) + $v19 + $v20)/6; $disgustlong = sprintf("%.2f", $disgustlong); } open(INFO, ">>$ENV{'DOCUMENT_ROOT_OLD'}/www/relationshipsresearch.com/P593/HW4.txt"); print INFO "$date1,$date2,"; print INFO "$v01,$v02,$v03,$v04,$v05,$v06,$v07,$v08,$v09,$v10,$v11,$v12,$v13,$v14,$v15,$v16,$v17,$v18,$v19,$v20,$rellength,$disgust,$disgustshort,$disgustlong,"; print INFO "endline\n"; close (INFO); $sum= 0; $n= 0; open(INFO, "$ENV{'DOCUMENT_ROOT_OLD'}/www/relationshipsresearch.com/P593/HW4.txt"); @data = ; close(INFO); foreach $key (@data) { @a = split(/,/,$key); $sum= $sum + $a[23]; $n= $n + 1; $disgustmean = $sum/$n; $disgustmean = sprintf("%.2f", $disgustmean); } # Disgust mean for short past relationships (one year or less) if($rellength <= 12){ foreach $key (@data) { @a = split(/,/,$key); $sum= $sum + $a[24]; $n= $n + 1; } $disgustmeanshort = $sum/$n; $disgustmeanshort = sprintf("%.2f", $disgustmeanshort); } # Disgust mean for long past relationships (more than a year) if($rellength > 12){ foreach $key (@data) { @a = split(/,/,$key); $sum= $sum + $a[25]; $n= $n + 1; } $disgustmeanlong = $sum/$n; $disgustmeanlong = sprintf("%.2f", $disgustmeanlong); } print ""; print ""; print ""; print ""; print ""; } } #Comparison for short past relationships if($rellength < 12){ if($disgustshort < $disgustmeanshort){ print "Your disgust score is below the average score for all participants who were in their former relationship for a year or less ($disgustmeanshort).

"; } if($disgustshort >= $disgustmeanshort){ print "Your disgust score is above or equal to the average score for all participants who were in their former relationship for a year or less ($disgustmeanshort).

"; } } } if($pass == 2){ print "
Past Relationship Questions Part 2


Please indicate how much you agree with the following statements.

1. I miss my ex-partner.
Strongly Disagree Strongly Agree

2. The thought of being intimate with my ex-partner disgusts me.
Strongly Disagree Strongly Agree

3. I do not want to see or talk to my ex-partner.
Strongly Disagree Strongly Agree

4. If my ex-partner wanted to, I would get back together with him or her.
Strongly Disagree Strongly Agree

5. I try not to think about my ex-partner.
Strongly Disagree Strongly Agree

6. Sometimes I cannot remember why I ever liked my ex-partner.
Strongly Disagree Strongly Agree

"; } # end pass = 2 if($pass == 1){ print "
Past Relationship Questions

Please answer the following questions about your most recent ex-partner.


1. What is your ex-partner's name?



2. How long were you in romantic relationship (dating or married) with your ex-partner before you broke up?

years   months

3. How long has it been since you and your ex-partner broke-up?

years   months

4. Please indicate which of the following statements describes your break-up with your ex-partner. Please feel free to check as many as you wish.

My ex-partner initiated the break-up.
I initiated the break-up.
The break-up was mutual.
My ex-partner and I broke up and got back together several times before this break-up.

5. Describe a time when you thought your ex-partner might not be the right person for you.


If there was never a time when you thought your ex-partner might not be the right person for you, please check here.



"; } #end pass = 1 if($pass == 0){ print "
Survey about your former relationship



General Questions

1. How old are you?

years

2. What is your gender?



3. What is your country of origin?





"; } # end pass == 0 print $query->end_html;
"; print ""; print "
Thank you for participating in the study. Have a nice day.


"; print ""; print "Your disgust score is $disgust on a scale ranging from 1 (low disgust) to 5 (high disgust).

"; #Compared to whole sample average if($disgust >= $disgustmean){ print "Your disgust score is above or equal to the average score for all participants ($disgustmean).

"; } if($disgust < $disgustmean){ print "Your disgust score is below the average score for all participants in the study ($disgustmean).

"; } #Comparison for long past relationships if($rellength > 12){ if($disgustlong < $disgustmeanlong){ print "Your disgust score is below the average score for all participants who were in their former relationship for more than a year ($disgustmeanlong).

"; } if($disgustlong >= $disgustmeanlong){ print "Your disgust score is above or equal to the average score for all participants who were in their former relationship for more than a year ($disgustmeanlong).