Matthias Neeracher wrote: > > >use Mac::Events; >use Mac::LowMem; > >LMSetSysEvtMask(LMGetSysEvtMask() | keyUpMask); > >Matthias > Thanks, that helps. Now at least I know hot to detect the keyUp event. It produces a little side effect though. As the code below shows, the results of the print statement in the 'keyDown_Handler' subroutine doesn't show up until after the 'keyUp_Handler' subroutine has been triggered by the keyUp event. Another problem shown in the code below... I'm trying to measure the length of time a key is held down but can't figure out how to measure fractions of a second. Jim Miner graciously showed me how to wait for fractions of seconds by using select(undef, undef, undef, $timeout); Thanks Jim. Appreciative of all the help. David Seay http://www.mastercall.com/g-s --------------- #!perl use Mac::Events; use Mac::Events qw(@Event $CurrentEvent); use Mac::LowMem; $Event[keyDown] = \&keyDown_Handler; $Event[keyUp] = \&keyUp_Handler; LMSetSysEvtMask(LMGetSysEvtMask() | keyUpMask); WaitNextEvent while !$flag; sub keyDown_Handler { $startTime = time; my($ev) = @_; $k = chr($ev->character); if (($CurrentEvent->modifiers & 256) == 256 && $k eq ".") { $flag = 1 } else { print "KEY DOWN = $k " } } sub keyUp_Handler { $endTime = time - $startTime; print "for $endTime seconds.\n\n"; } ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch