perl -le '$choice='1'; %hash=( '0' => \&one, '1' => \&two ); $hash{$choice}->(); sub one {print "one"}; sub two {print "two"}'