Greetings, have you considered Expect?
In reply to Re: Run an interactive shell command from Perl script by marto in thread Run an interactive shell command from Perl script by nofear_asa