Although I get the impression that the answer you're looking for has been mentioned already, but if not maybe the post howto capture a keystroke can help you out!
LuCa
Comment on Re: Is it possible in perl to detect keyboard events like as "when keydown"