in reply to Facing problem with Telnet

Hi,

You can use the method waitfor, for example:

my $pre_pass_prompt = q{Do \s you \s want \s to \s send \s anyway}; # save the current prompt my $current_prompt = $obj->prompt; # wait for the prompt $obj->waitfor(Match => m{$current_prompt}smx, Match => $pre_pass_prompt); # # check if the last prompt matched it's the $pre_pass_prompt if ($obj->last_prompt() =~ m{$pre_pass_prompt}smx) { # send the reply $obj->cmd(q{y}); }
in many cases the login process have to be done using the waitfor, you can find more information about that in the Net::Telnet.