my %command = ( foo => \&do_foo, bar => sub { print "doing bar with parameters: @_\n"; }, # ... );