#!/usr/bin/perl use strict; use warnings; use Net::OpenSSH; use Expect; $| = 1; my $username = ''; my $password = ''; my $enable = ''; my $ip = '10.105.0.62'; my $ssh = Net::OpenSSH->new("$username:$password\@$ip", timeout => 30); $ssh->error and die "unable to connect to remote host: ". $ssh->error; my ($pty, $pid) = $ssh->open2pty("show ip arp") or die "unable to run remote command show ip arp"; my $expect = Expect->init($pty); $expect->raw_pty(1); #$expect->debug(2); my $debug and $expect->log_stdout(1); while(<$pty>) { print "$. $_" }