For an example of how you can use Term::ReadKey in a manner similar to Pascal's
keypressed function check out my module
Term::TermKeys.
The module works best with the predefined terminal
emulations (vt52, vt100, vt102, and vt220) but is still
somewhat functional in a Windows environment. I wouldn't necessarily recommend using my module directly, but it can be useful as example code.
--Jim