my %function = ( set => \&set, add => \&add, mul => \&mul ); # later: if (exists $function{ $command } ) { $function{command}->($register,$param); } else { die "No such function: ($command)"; }