Robin Turner (
robinturner) wrote2003-01-27 02:05 am
Health benefits of coding
Whenever I start to get upset at the trivia of my life, this kind of thing calms me down:
} else {
$testfile = $query->param('testchoice');
$testfile =~ s/Sublists/P/g;
$testfile =~ s/Multiple Choice/M/g;
$testfile =~ s/ /_/g;
$testfile = $filebase.$testfile.$extension;
open(FILE, "$testfile");
(@lines) =;
# @questions = [];
@right = [];
@wrong = [];
foreach $line (@lines){
if ($line =~ /^Q/){
push (@questions, $line);
}
elsif ($line =~ /^\*/){
push @right, $line;
}
else {push @wrong, $line;}
}
for ( $i=0; $i<=@wrong; $i++) {
$x = $wrong[$i];
print $query->p("$x");
}
close(FILE);
} else {
$testfile = $query->param('testchoice');
$testfile =~ s/Sublists/P/g;
$testfile =~ s/Multiple Choice/M/g;
$testfile =~ s/ /_/g;
$testfile = $filebase.$testfile.$extension;
open(FILE, "$testfile");
(@lines) =
# @questions = [];
@right = [];
@wrong = [];
foreach $line (@lines){
if ($line =~ /^Q/){
push (@questions, $line);
}
elsif ($line =~ /^\*/){
push @right, $line;
}
else {push @wrong, $line;}
}
for ( $i=0; $i<=@wrong; $i++) {
$x = $wrong[$i];
print $query->p("$x");
}
close(FILE);