my %subhash = { do_run => \&do_run, do_walk => \&do_walk, do_skip => \&do_skip }; foreach ( @do_something ) { if ( defined $subhash{ $_ } ) { &{ $subhash{ $_ } }(); } }