http://www.perlmonks.org?node_id=574685


in reply to EOF character

Did you try:
print "\cD";
And did that work?

Perhaps you need the Expect module?