while ($graduated = "no") { $day = $day + 1; if ($mylife =~ /drinking/) { $test[$day] = "fail"; } if ($mylife =~ /studying/) { $test[$day] = "pass"; } $mylife = $mylife . "drinking"; $mylife =~ s/sleep/no sleep/; unless ($test[$day] = "pass") { $graduated = "no"; } }

Replies are listed 'Best First'.
Re: Neverending Life of a Student
by voyager (Friar) on Jun 02, 2001 at 03:09 UTC
    Is the first line a typo (= v. eq) or a joke, and hence then never-ending life (or never-ending while loop)?
Re: Neverending Life of a Student
by gollem (Acolyte) on Jun 02, 2001 at 14:55 UTC
    I'd probably go with something like this
    while(!$graduated) { $day++; if($test[$day]) { &write_test } &party; } sub write_test { if(int rand 100 > 90) { print "Test passed\n"; } else { print "Test failed\n"; } }
    The party subroutine is way to complex to submit here..