> -----Original Message----- > From: David T-G [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, June 04, 2002 1:04 PM > To: perl beginners > Cc: Bob Showalter > Subject: Re: printing key codes > > > Bob, et al -- > > ...and then Bob Showalter said... > % > % > -----Original Message----- > % > From: David T-G [mailto:[EMAIL PROTECTED]] > ... > % > which will read stdin, spit out the key codes it gets until a > ... > % > % How 'bout: > % > % perl -lpe '$_ = join ", ", unpack("c*", $_)' > > Aha! So I need to go and read up on unpack; I was thinking > pack because > I had it backwards. > > Is there a simple way to get perl to spit out one line per incoming > keycode? That is, get it to spit out > > 27, 79, 80 > 27, 91, 50, 51, 126 > > when it sees F1 followed by Shf-F1 without a newline between them?
Well, if you want to really be using function keys and arrow keys and that kind of stuff, you really should use something like curses. Then you can just refer to F1 as K_F1, etc. Perl has a nice Curses.pm module to handle this. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]