#! /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 ;