in reply to Telnet to server

Thanks guys ..Ok i got something working. I was able to login to router and get the command to execute on router and print output But the program just executes the command and returns to my bash prompt. I want to stay logged in to the router to do my tasks. How do I keep the router prompt from returning back to the my bash shell I ran the below code
use Net::Telnet::Cisco; my $session = Net::Telnet::Cisco->new(Host => '192.168.25.133', Port + =>'2002'); my @ok = $session->login(); my @output = $session->cmd('sh ver'); print @output;

Replies are listed 'Best First'.
Re^2: Telnet to server
by perlron (Pilgrim) on Oct 31, 2014 at 12:04 UTC
    Hi
    You could check the first reply to this post on telnet error handling in your particular case.Trapping errors in Net::Telnet::Cisco
    As you might be aware Some routers dont allow users to logon using telnet for security reasons, and if they do for operational reasons, there might even be restictions on what type of commands can be used.
    Having said that i see you were able to have some kind of a handshake with the router, so i guess its trial and error for you now.
    All the best

    The temporal difficulty with perl is u need to know C well to know the awesome.else u just keep *using* it and writing inefficient code