#!/bin/perl # Modified Feb 8 by agw to ask user to repeat e-mail address # to confirm triviaq.pl --> creates question form for trivia contest $date = `/bin/date`; @date = split(/ +/,$date); # note the + after the space delimiter # with a single-digit day, UNIX prints Fri Dec 1 10:43:57 CST 1995 # which has an extra space in front of the day. That would create # an empty field unless multiple consecutive delimitors were treated # as one # note that the elements of @date are: # 0. Day of Week (ie Wed) # 1. Month (ie Nov) # 2. Number of day (ie 29) # 3. Time (ie 11:50:01) # 4. Time Zone (ie EST) # 5. Year (ie 1995) $qnum = $date[2]; $month = $date[1]; $displaydate = "$date[2] $date[1] $date[5]"; open(QFILE,"../data/nmc/nmctrivia/$month.txt") || die "Cannot read nmc/nmctrivia/$month.txt"; $inline = ; until ($inline =~ m#^$qnum/#) { $inline = ; } $qin = $inline; chop($qin); $inline = ; until ($inline =~ m#^\d{1,2}/#) { $qin = $qin . $inline; chop($qin); $inline = ; } @qbits = split(/\//,$qin); $qques = $qbits[1]; $a = $qbits[2]; $b = $qbits[3]; $c = $qbits[4]; $d = $qbits[5]; $a =~ s/\*//; $b =~ s/\*//; $c =~ s/\*//; $d =~ s/\*//; print <<"EndPrn"; Content-TYPE: text/html Trivia Question for $displaydate

Question for $displaydate

Enter your e-mail address, so that we can tally your score and contact you if you win. Don't forget to use the same e-mail address each day!

E-mail address:

Please type your e-mail address a second time to confirm:

E-mail address:

$qnum) $qques
$a
$b
$c
$d

[ Return to @Canada ]

EndPrn close (QFILE);