use strict; use warnings; use Net::Telnet(); my $host = '10.10.1.5'; my $input = ""; my $t = Net::Telnet->new(Host       => $host,                         Timeout    => 15,                         Input_log  => *STDOUT,                         Output_log => *STDOUT,                        ) or die Net::Telnet::error(); $t->print("help"); my $line = $t->getline; &connected; sub connected   {    $t->waitfor(-match => '/SERVER_4711>/',                -errmode => "return",               ) or die "problem connecting to host: ",    $t->lastline;    #while ($input eq "")    #     {           $input = ;           $input = lc $input;           chomp $input;           $t->print("$input");           $line = $t->getline;           $t->lastline;     #    }          &connected;   }