programming-examples/perl/SystemFunction/system -stty cbreak &1.pl

12 lines
286 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
system "stty cbreak </dev/tty >&1";
print "Type an up arrow:";
$c1 = getc;
$c2 = getc;
$c3 = getc;
if ((ord($c1) == 27) && ($c2 eq '[') && ($c3 eq 'A')) {
print "You typed an up arrow.";
} else {
print "You did not type an up arrow.";
}