my $host = "host123"; my $username = "bobjones"; my $password = "mypassword"; my $thost = new Net::Telnet( Timeout => 20, Host => $host, Errmode => "return" ); $thost->login( $username, $password ); my $prompt = "_MYPROMPT_"; $thost->prompt("/$prompt\$/"); $thost->cmd("set prompt = '$prompt'"); # depends on the shell in use. my $command = "ls"; my @out = $thost->cmd($command); $thost->close;