in reply to Question about untainting data

Usually I have user input for searching a database, so in almost all cases I can exclude non-word characters. But I have also some scripts the user can influence by his input, in a way that one subroutine is called based on the input in a select box. But I never call the subroutine directly from the users input, but use a construct like the following
<snip> if ($user_input eq "do this") { &sub_a; } elseif ($user_input eq "do that") { &sub_b; } else { &error("","unexpected input","The input you supplied is not supporte +d"); } </snip>
Strictly speaking this is not untainting. If this is insecure in any way, please inform me.
Thanks

neophyte