sub main { my $q = CGI->new; my $func = $q->param('func'); if ($func eq 'somefunc') { &somefunc } } sub somefunc { my $q = CGI->new; }