Created
July 6, 2009 13:39
-
-
Save cowens/141430 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use Term::ReadKey; | |
use Time::HiRes qw/usleep/; | |
ReadMode 4; | |
my $buf = '0b'; | |
while(1) { | |
my $key; | |
usleep 500 until defined ($key = ReadKey(-1)); | |
$buf .= 0 if $key eq 'j'; | |
$buf .= 1 if $key eq 'k'; | |
if (length $buf == 10) { | |
print chr oct $buf, "\n"; | |
$buf = "0b"; | |
} | |
last if $key eq 'l'; | |
} | |
ReadMode 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment