Have you tried using $ion->login($username, $passwd);
Instead of doing it the hard way? Here's a sample script I use with net::telnet that works just fine... Might want to try modifying it. I use a hosts file, because my script hits a number of machines. The only bit that might be confusing is the regex for the prompt. The prompt is in the format [user@host directory] on the clients I am connecting to. use strict; my ( $hostname, $passwd, $username); $username = "username"; $passwd = "password"; open (HOSTS, "hosts.txt") or die "Could not open hosts file."; while (<HOSTS>) { chomp($hostname = $_); $hostname =~ s/^\s+//; $hostname =~ s/\s+$//; #chomp ($hostname); ## Connect and login. use Net::Telnet (); $host = new Net::Telnet (Timeout => 30, Prompt => '/\[.*?\]\#/'); $host->open($hostname); $host->login($username, $passwd); $host->waitfor(/\[.*?\]#/); #do stuff here! } exit; -----Original Message----- From: Joe Mecklin [mailto:[EMAIL PROTECTED]] Sent: Monday, August 12, 2002 11:13 AM To: [EMAIL PROTECTED] Subject: Net::Telnet question Using Net::Telnet, I'm having trouble getting the server I'm connecting to to recognize my input to the login prompt. Below is the code so far (all system/user details have been changed to protect the innocent): #! /usr/bin/perl # tnp - TelNet via Perl # trial program to replace Expect script use Net::Telnet (); $ion = new Net::Telnet ( -host => "system.name.com", -port => 1234, -output_record_separator => "\r" ); $ion->dump_log("ion_log"); $ion->binmode(1); if ($ion->open()) { print "Connected...\n"; } if ($ion->waitfor(-string => "User ID:")) { print "Saw \"User ID:\" ...\n"; $ion->print("username"); } if ($ion->waitfor(-string => "Password:")) { print "Saw \"Password:\" ...\n"; } $ion->close(); $ion->dump_log; ##### end of program When I run this, after printing Saw "Password:" ... the connection times out every time. Looking at ion_log, the last entry is ... various text and ANSI codes ... username indicating that it was successfully passed to the server. I have tried the ->print and ->put calls, with and without various combinations of \r and \n, with and without binmode() on. This same functionality currently exists in a working Expect script (with \r appended to each input) but I'd like to get it working in Perl as well. Any ideas on what may be missing will be greatly appreciated. Joe -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]