Have you tried using the
Net::Telnet module? It is almost always better (not to mention more portable) to use the Net::* modules to access network services than to try and control external programs.
However even if you do need to control an external program, I have found Net::Telnet to be more reliable than Expect.pm anyway (just connect to localhost and go from there). I'm not entirely sure why Expect.pm was failing in background processes, but I am using Net::Telnet in the background at the moment (on Tru64 UNIX) with no problems.
JJ