# First, handle the sensible default $Max_Questions = $Total_Questions unless defined $Max_Questions; # Now check for errors if($Max_Questions > $Total_Questions){ croak "Number of questions in $FileName exceeded"; $Max_Questions = $Total_Questions; }elsif($Max_Questions < 1){ croak "Must have at least one question in the test."; $Max_Questions = 1; } # Now we have a valid number of questions &_set_Max_Questions($self,$Max_Questions);