if ( $CGI->param( "submit_answers" ) ) { displayAnswers( $CGI ); #the name of your sub } else { displayQuiz( $CGI ); }