in reply to input switch

You might also look into using CGI::Application. It uses "run modes" to sort out these issues.

Simplified Example (modified from CGI::App docs):
# In "WebApp.pm"... package WebApp; use base 'CGI::Application'; sub setup { my $self = shift; $self->mode_param('action'); $self->run_modes( 'delayedinv' => 'delayedinv', 'del_inv' => 'del_inv', 'played' => 'played' 'stats' => 'stats' 'AUTOLOAD' => 'defscreen' ); } sub delayedinv { ... } sub del_inv { ... } sub payed { ... } sub stats { ... } sub defscreen { ... } 1; ### In "webapp.cgi"... use WebApp; my $webapp = WebApp->new(); $webapp->run();
It has many other nice features. See the docs for more info.