#!/usr/local/bin/perl my %dispatch = ( one => \&one, two => \&two, ); print "Enter Choice :"; my $choice = ; chomp($choice); my $sub = $dispatch{$choice}; if (defined($sub)) { &$sub; } else { print "That choice doesnt exist\n"; } sub one { print "Choice one\n"; } sub two { print "Choice two\n"; }