The following works great in windows. Shows you what the keyboard produced, exits when you hit ENTER. Note that some keys (like arrows) produce multi-character sequences.
#!/usr/bin/perl -w use strict; use Term::ReadKey; my $key; my $OrdKey; ReadMode 'raw'; do { $key = ReadKey(0); $OrdKey = ord($key); print "Key is $OrdKey\n"; } while ($OrdKey != 13); ReadMode 'restore';
In reply to Re: howto capture a keystroke
by Anonymous Monk
in thread howto capture a keystroke
by jeanluca
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |