At 3:20 PM +0530 2/20/10, suresh kumar wrote:
Hi Folks,
I am trying to connect to a server where i want to create a file or read a
existing file.
This is my code.
#!/usr/bin/perl
use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10,
Prompt => '/] $/');
You are asking Net::Telnet to wait for a prompt that end in the two
characters '] ' (left bracket and space).
# My prompt will be looking after telnet session like this "[
ekus...@lxlogin-2-wip ~ ]"
That prompt does not have a space after the left bracket and will not
match the pattern. Which is correct?
$t->open("172.16.246.14");
$username = "ekusure";
$passwd = "qwert123";
$t->login($username, $passwd);
@lines = $t->cmd("who");
print @lines;
I am getting an error
timed-out waiting for a command prompt at ./telnetserver line 8
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/