3.3.3.*
3.3.9.*
23.23.1.49
####
#! /usr/bin/perl -w
# run telnet to port xx29
# read data
use strict;
use diagnostics;
use Net::Telnet;
my $file = 'iplist1.txt' ;
#my $command = `/bin/ping` ;
open (OUT,'>', "telnet.log");
open (IPS, '<', $file)
or die('unable to open the file', $file );
while() {
#ping($_) ;
#print "$_ " ;
my $telnet = Net::Telnet->new(Host=>"$_", Port=>'xx29', timeout=>4), errmode=>
(sub {
open(OUT, ">>telnet.log");
print "Bad connection - Unable to connect to IP $_ at \r\n" ;
print "-------------------\r\n";
next;}));
}
close OUT ;
close IPS ;
####
Use of uninitialized value $_ in concatenation (.) or string at run_telnet.pl
line 22, line 1 (#1)
(W uninitialized) An undefined value was used as if it were already
defined. It was interpreted as a "" or a 0, but maybe it was a mistake.
To suppress this warning assign a defined value to your variables.
To help you figure out what was undefined, perl will try to tell you the
name of the variable (if any) that was undefined. In some cases it cannot
do this, so it also tells you what operation you used the undefined value
in. Note, however, that perl optimizes your program and the operation
displayed in the warning may not necessarily appear literally in your
program. For example, "that $foo" is usually optimized into "that "
. $foo, and the warning will refer to the concatenation (.) operator,
even though there is no . in your program.
Bad connection - Unable to connect to IP at
-------------------
Exiting subroutine via next at run_telnet.pl line 24, line 1 (#2)
(W exiting) You are exiting a subroutine by unconventional means, such
as a goto, or a loop control statement.
Use of uninitialized value $_ in concatenation (.) or string at run_telnet.pl
line 22, line 2 (#1)
Bad connection - Unable to connect to IP at