my %do_for = ( get_hosts => \&GetHosts, get_new_fw_rules => \&GetNewFWRules, ); #... $do_for({$what_to_do}->( $_, \%data );