in reply to switch statement for subroutines?

All of the code provided in reply has been workable, but I notice that no one has mentioned a couple of errors in your code to you. While good solutions have been given to solve your current dilemma, I'd like to point the errors out to you so they don't bite you at a later date.

In your code, you attempt to test with $_ = "do_run". This is actually assigning 'do_run' to the variable. The string test operator is eq, so you want if $_ eq 'do_run'. (For numeric comparison, use ==). Also, you do not call a subroutine in perl -- just use the subroutine name.

When 'if' begins the line and is followed by a comparison, the comparison requires parentheses. Also, the block to be run on true needs to have brackets. Both of these can be eliminated in the switched around version (see below) due to precedence and syntax.

A final note (this isn't a bug, just a style issue) ... you are using double-quotes, which does variable interpolation within the string. Since you are not interpolating variables, single quotes will suffice. So the way a string comparison might look is:
if ($_ eq 'do_run') { do_run() }
The alternative style ("switched around" as I called it above) would appear as:
do_run() if $_ eq 'do_run';

-HZ