Expect.pm is built to either spawn a process or take an existing filehandle and interact with it such that normally interactive tasks can be done without operator assistance.
Expect let your program start another program and pretend human typing into keyboard to talk to another program.