-print "Press a key: ".$M;
-$x = getc;
-print $N.$/.$/;
-if (defined($menu_commands{$x})) {
- $command = $menu_commands{$x};
-} elsif ($x eq "\n") {
- $command= 'exit';
-} elsif ($x eq "x") {
- print <<"EOF";
+ print "Press a key: ".$M;
+ ReadMode 4; # Turn off controls keys
+ while (not defined ($x = ReadKey(-1))) {
+ # No key yet
+ }
+ ReadMode 0; # Reset tty mode before exiting
+
+ print $N.$/.$/;
+ if (defined($menu_commands{$x})) {
+ $command = $menu_commands{$x};
+ } elsif ($x eq "\n") {
+ $command= 'exit';
+ } elsif ($x eq "x") {
+ print <<"EOF";