--- Denzil Kruse <[EMAIL PROTECTED]> wrote: > Once the script figures out which page it should go > to, I dont want to have to do this: > > if ($page == 1) { &page1() } > if ($page == 2) { &page2() } > if ($page == 3) { &page3() }
As mentioned previously, CGI::Application is a good choice for this sort of problem, but you can also use a dispatch table. In this case, assuming we're using a hash: my %dispatch = ( new => \&new, edit => \&edit, delete => \&delete, ); my $action = $cgi->param('action'); if (my $action = $dispatch{$action}) { $action->(@some_args); } else { # die or go to a default page } Solutions like this is generally easy to understand (particular when using named actions). Cheers, Ovid -- If this message is a response to a question on a mailing list, please send follow up questions to the list. Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>