my @found = (); my $err = ''; for $c (@$Courses) { if (&is_good ($c)) { push @found, $c; } else { $err = "Problem: $c failed the test.\n"; } last if (($err) || (@found >= 10)); } for $c (@found) { print PageCourseInfo ($c); } print $err if ($err);