in reply to Re: How do I loop until keyboard input?
in thread How do I loop until keyboard input?

I have tried Readkey but from my experience it is still waiting for input before it continues the loop.
#!/usr/bin/perl -w use strict; use Term::ReadKey; my $done = 0; my $choice; my $key; ReadMode 4; while (! $done) { if (defined($key = ReadKey(-1))) { print "Test\n"; $choice = uc ($key); $done = 1 if ( $choice eq "Q" ) } } ReadMode 0;

Replies are listed 'Best First'.
Re^3: How do I loop until keyboard input?
by gellyfish (Monsignor) on Dec 15, 2004 at 15:31 UTC

    No it isn't if you have ReadMode 4 set. Of course if you have actually tried the code and it doesn't do what you expect then please can you send me a bug report stating the OS, Term::ReadKey and Perl version and with the exact code that you were trying to use.

    /J\

      retard error had the print statement in the wrong loop. I need more coffee!!