my %dispatch = ( home => \&home, donate => \&donate, news => \&news, faq => \&faq, .... ); #### my %dispatch = ( home => sub { \&home(); }, donate => sub { \&donate(); }, news => sub { \&news(); }, faq => sub { \&faq(); }, .... ); #### my $default_action = 'home'; my $action = $cgi->param('a') || ''; # is $action recognized? my $executor = $dispatch{$action} || $dispatch{$default_action}; &$executor(); #### ... some html.... #### ...some placeholders here... ... placeholders for FAQ ... .... Today:

... #### # assuming load_template() is defined somewhere # to return a template object my $faq = load_template('faq.html'); $faq->param(PARAMS_FOR_FAQ_PLACEHOLDERS); my $news = load_template('news.html'); $news->param(PARAMS_FOR_NEWS_PLACEHOLDERS); my $template = load_template('main.html'); $template->param( today => scalar(localtime), news => $news->output, faq => $faq->output, ); print $template->output;