in reply to expect.pm
When I run your test under my environment
(Perl 5.005_02 w/ Expect 1.07) it works properly
(no re-echoing of earlier prints). Does
the behavior you see only occur only when running
as a CGI or when run from the command-line as well?