in reply to Send a keyboard input to a process

Depends on the process, not on perl. Some processes don't handle any keyboard input, so you can't send any input to that process. Those processes that handle input may do it using different ways, via controlling tty, or via events loop of GUI.