my $cgi = CGI::Minimal->new; my $action = $cgi->param("action"); for( $action ) { /list_all_users/ and do { # either a function call or more code here last; }; /add_user/ and do { # either a function call or more code here last; }; /edit_user/ and do { # either a function call or more code here last; }; # and so on } # code to output resulting web page