yoda54 has asked for the wisdom of the Perl Monks concerning the following question:
my %hash = ( "func" => \$func, "func2 => \$func2, ... "func1000 => \$func1000 ); while () { &menu(); print "select: "; chomp($string = <STDIN>); if ($hash{$string}) { $hash{$string}->(); } else { print "No such command: $string\n"; sleep 1; system("clear"); } } sub quit { exit; } sub func { blah... } sub func2 { blah2... } sub menu { while( my ($k, $v) = each %hash) { print "$k \n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: menu script
by beable (Friar) on Jul 17, 2004 at 11:23 UTC | |
|
Re: menu script
by davido (Cardinal) on Jul 17, 2004 at 15:21 UTC |