You do have code for these cases? So in addition to your logic above you have:
sub this {
return "this"; # Whatever
}
sub that {
return "that"; # Being simple here
}
# etc
Combine the two:
my %action = (
this => sub {return "this"},
that => sub {return "that"},
# etc
);
# Then later:
if (exists $action{$in}) {
$action{in}->();
}
In fact if you have a lot of cases you can probably find room to factor:
sub ret_simple_returner {
my $arg = shift;
return ($arg, sub {$arg});
}
my %action = map ret_simple_returner($_), qw(this that);
The point being that every time you eliminate the need to keep two pieces of code in sync you eliminate another possible source of bugs...