Skip to content

Instantly share code, notes, and snippets.

@cowens
Created July 6, 2009 13:39
Show Gist options
  • Save cowens/141430 to your computer and use it in GitHub Desktop.
Save cowens/141430 to your computer and use it in GitHub Desktop.
#!/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