You can put escape codes in string literals in perl. For example "\e[1;10m" is a cursor position code. Control-C is "\x03".
Remoting a console program is a common task with Perl. I've written perl scripts that use pipes to a local ssh client which connects to a remote ssh server, then starts screen on the remote server and multiplexes multiple programs on the remote server, and has timeouts and creates a new console in screen, then kills the hung process in the other console after a certain time period elapses.