in reply to Naming Subs

I have something similar in a quick & dirty piece of code that wraps some version control system code. I give it the verb on the command line as an argument, such as "get" or "co" (for checkout). It jumps to a handler for each known verb exactly like you are asking.

I don't remember which of the many possible ways I used to turn the variable into an actual function call. I think today $action->() would do the trick.

But, this is a problem with release code because the user could trigger a jump to any function in the code, not just those you are intending! So to make it more robust I named the option functions something distinct, with a prefix on the verb. E.g. "get" would call sub option_get. If the user typed foo instead, it would complain about the lack of an option_foo, rather than jump to sub foo. Only the intended targets had names of this form.

—John