CGI::Application provides a framework for tackling this very problem.
In reply to Re: Flow control / case structure by dws in thread Flow control / case structure by George_Sherston