If you want to automate the script then you want to steer AWAY from user input/output so you don't want to click anything.
Look at passing the inputs to your shell script from perl.
If you have a very interactive shell script you will need to capture the output of the script in perl and have a conversation with it.
Have a look at backticks in the perl manual or qx//;
As
keszler said
IPC::Run seems your best bet for an interactive relationship.