in reply to scan keyboard

A built-in function that read a character from STDIN is getc.

Not built-in, but from CPAN, check Term::ReadKey and Term::ReadLine