use CGI qw(:all); my $op = param('operation'); my $table = create_dptable TestPkg; $table->{$op}->() if exists $table->{$op}; #### use CGI qw(:all); my $op = param('operation'); { no strict 'refs'; TestPkg->$dispatch('Hello!') if defined *{"TestPkg::$dispatch"}{CODE}; } #### my $input = <>; my $table = create_dptable TestPkg; $table->{$_}->($input) foreach (keys $table); #### my $input = <>; { no strict 'refs'; *{"TestPkg::$_"}{CODE}->($input) foreach( grep { !/^_/ && defined *{"TestPkg::$_"}{CODE} } keys %{*{'TestPkg::'}} ); }