$connection->send("$cmd\r"); if(length($cmd) > "25") { $cmd = substr($cmd, -20); } $connection->expect(8, '$cmd'); $connection->expect($timeout, $prompt); $data = $connection->exp_before(); print "Command DATA: \n$data\n";