$t = Net::Telnet->new(Timeout => 10, Port => 23,Prompt => '/.*\>/'); #### $t2 = Net::Telnet->new(Timeout => 10, Port => 23,Prompt => '/.*\>/'); #### use Net::Telnet; use Getopt::Long; getOpts (); create_streams (); if (defined($duration)) {sleep $duration;} if (!defined($duration)) {sleep 3600;}# default to an hours run time ############################################################ # A simple routine to connect to a telnet Virtual IP ,port 23 # ############################################################ sub create_streams { $ip1 = 192.168; $ip3 = 1; $ip4 = 1; LOOP: if ($ip4 == 254) { $ip3++; $ip4 = 1; } $t = Net::Telnet->new(Timeout => 10, Port => 23,Prompt => '/.*\>/'); $t->timeout; $t->open(Host => "$ip.$ip3.$ip4", Errmode => "return", Timeout => 1); if ($ip3 == 254) {goto NEXT;} $ip4++; goto LOOP; NEXT: }