In the time-honoured tradition of TMTOWTDI, if you replace
if ( $key eq "\e" ) { print "Escape pressed\n"; }
with
if ( $key eq "\e" && $key eq "\x1b" && $key eq "\033" && $key eq "\c[" && $key eq "\x{1b}" && $key eq "\o{33}" && $key eq "\N{ESCAPE}" && $key eq "\N{U+001B}" && $key eq v27 && ord($key) == 27 && ord($key) == 0x1b && ord($key) == 033 && ord($key) == 0o33 && ord($key) == 0b11011 ) { print "Escape pressed\n"; }
you'll get the same result.
I don't claim that's a non-exhaustive list of all possibilities, but I think it's pretty close.
You can find references to all of those in one or more of: perlop; perldata; perlrebackslash.
— Ken
In reply to Re^5: Capture a non-printable char and test what it is
by kcott
in thread Capture a non-printable char and test what it is
by almsdealer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |