in reply to How do I loop until keyboard input?
It is not so easy to do this directly from STDIN, you might be better off using Term::ReadKey:
use Term::ReadKey; my $done = 0; my $choice; ReadMode 4; while ( !$done ) { if ( defined( $key = ReadKey(-1) ) ) { $choice = uc ( $key); $done = 1 if $choice eq 'Q'; } } + ReadMode 0;
/J\
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do I loop until keyboard input?
by skitchy (Initiate) on Dec 15, 2004 at 15:25 UTC | |
by gellyfish (Monsignor) on Dec 15, 2004 at 15:31 UTC | |
by skitchy (Initiate) on Dec 15, 2004 at 15:35 UTC |