my ($hostname, $line, $password, $pop, $username); $hostname = "local_host"; $username = "name"; $password = "pass"; $file = "log_file"; $file1 = "dump_log"; use Net::Telnet (); $pop = new Net::Telnet (Telnetmode => 1, Input_log => $file, dump_log => $file1); $pop->open(Host => $hostname,Port => port#); $pop->waitfor('/login: $/i'); $pop->print($username); $pop->waitfor('/password: $/i'); $pop->print($password); $pop->print("terminal type"); $pop->waitfor('/Command: $/i'); $pop->print("terminal_command"); $line = $pop->get; print $line; open FILE, "data.txt" or die $!; print FILE $line; close FILE;