use strict;
my %commands = ( "command1" => \&sub1,
"command2" => \&sub2,
"command3" => \&sub3,
"command4" => \&sub4,
"command5" => \&sub5,
"command6" => \&sub6,
"exit" => sub { die "Goodbye" }
);
while(1){
print "1. command1\n";
print "2. command2\n";
print "3. command3\n";
print "4. command4\n";
print "5. command5\n";
print "6. command6\n";
print "7. exit\n";
print "\n\n";
print "Please choose an option from the menu above: ";
chomp(my $commands = );
if ($commands{my $string}) {
$commands{$string}->();
} else {
print "No such command: $string\n";
}
}
####
my $commands = <>;
chomp $commands;
####
my $this = &that($thing);