OUTPUT: This output was run against the same server, within 15 seconds of each other.#!/usr/local/bin/perl #=================================== ######################################### # START REQUIREMENTS ######################################### require 5.6.1; ######################################### # END REQUIREMENTS ######################################### ######################################### # START USE ######################################### use 5.6.1; use Net::Telnet; use strict; ######################################### # END USE ######################################### ######################################### # START MAIN ######################################### my ( $host, $hostname, @line1, @line2, $username, $passwd, $pro ); $hostname = "hp1"; $username = "root"; $passwd = "******"; ## Connect and login. use Net::Telnet (); $host = new Net::Telnet ( Timeout => 30, Prompt => '/[\$%#>] $/', Output_log => 'TELNET.out', Input_log => 'TELNET.out'); $host->open($hostname); $host->login($username, $passwd); $pro = "/##\$/"; #Set prompt code my $rc1 = $host->prompt("$pro"); #Debugging print "RC 1 -> $rc1\n"; #Set prompt on unix side my $rc2 = $host->cmd('PS1="##" export PS1'); #Debugging print "RC 2 -> $rc2\n"; #Get os type (@line1) = $host->cmd("uname"); #Debugging print " LINE 1 -> $line1[0]\n"; #Get hostname (@line2) = $host->cmd("hostname"); #Debugging print "LINE 2 -> @line2\n"; ######################################### # END MAIN ######################################### ######################################### # START SUBROUTINES ######################################### ######################################### # END SUBROUTINES ######################################### __END__ #End of running code
PLEASE HELP!!! Thank you in advance for all your time and effort ohh great monks!!!!!!!!!1 ############################### RC 1 -> /[\$%#>] $/ RC 2 -> 1 LINE 1 -> HP-UX LINE 2 -> hostname hp1 2 ############################### RC 1 -> /[\$%#>] $/ RC 2 -> 1 LINE 1 -> ##uname LINE 2 -> hp1 3 ############################### RC 1 -> /[\$%#>] $/ RC 2 -> 1 LINE 1 -> HP-UX LINE 2 -> hp1
In reply to Net::Telnet -> Strange variable output by novawolf1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |