use Expect; #Let's assume I am logged in to the Remote machine and $telnet is my Expect Handler. my $timeout = undef; my $prompt = "> "; $telnet->send("$command"); $telnet->expect($timeout, '-re', $prompt);