Thanks for your help, I added that .* after when I find it does not work, just would like to see if the Expect got any input from the terminal.
I realize it's okay if I execute the perl code from terminal.
But it does not work if I use modperl executed in apache. It will always return eof without any match. Any suggestion for this ?