sub first { print "This is first\n"; } sub second { print "This is second\n"; } sub dispatch { no strict 'refs'; my $command = shift; print "In dispatch, command = $command\n"; my %dispatch = ( 'a'=>'first', 'b'=>'second' ); &{$dispatch{$command}}(); } dispatch('a'); dispatch('b');