Thank you for the response. May be if I explain you what I am trying to achieve here might help you to understand better my problem. I am executing a command in the spawned process(terminal), now when the command gets executed correctly then it gives output. Now if the output cannot be accomodated with in the current terminal size, it would display More... in the bottom of the output(like when we do ls | more). I will have to send the carriage return to the terminal through expect and get the complete output so that I can proceed. But my code is not working, it actually is breaking down before I send the carriage return to the terminal. I am seeing the output through a logfile ($exp_inst->log_file("$templog", "w");). Can you suggest if the code is fine and if yes then any other alternative to achieve this
$exp_inst->expect($timeout,
);
sleep (2);
$exp_inst->expect($timeout,