#----------------------------- |
use Term::ReadKey; |
ReadMode ( 'cbreak' ); |
$key = ReadKey ( 0 ); |
ReadMode ( 'normal' ); |
#----------------------------- |
# download the following standalone program |
#!/usr/bin/perl -w |
# sascii - Show ASCII values for keypresses |
use Term::ReadKey; |
ReadMode ( 'cbreak' ); |
print "Press keys to see their ASCII values. Use Ctrl-C to quit.\n" ; |
while ( 1 ) |
{ |
$char = ReadKey ( 0 ); |
last unless defined $char ; |
printf ( " Decimal: %d\tHex: %x\n" , ord ( $char ), ord ( $char ) ); |
} |
ReadMode ( 'normal' ); |
#----------------------------- |