A dispatch table is often used for this. It helps separate your input data from your code and helps trap invalid data. It works under strict and warnings and is prettier than a string of if/elses. :-)
#!/usr/bin/perl
use strict;
use warnings;
my %dispatch = (
table1 => \&_upload_table1,
table2 => \&_upload_table1,
);
my $tablename = cgi->param('tablename');
die qq{bad param\n} unless exists $dispatch{$tablename};
$dispatch{$tablename}->();
sub _upload_table1 {
}
sub _upload_table2 {
}
update: <cough> added the call to the sub :-)