Your suggestion of sending su to Expect led me to recipe 15.13 of Perl Cookbook, "Controlling Another Program with Expect". It works. Thanks.
The problem this solves is that an application program needs to install itself, and needs root priviledges to create the /usr/share and other directories. Hence the need to have code that will log in as root.
Thanks again.