http://www.perlmonks.org?node_id=873269


in reply to Re^2: Problems with Net::OpenSSH
in thread Problems with Net::OpenSSH

But your router seems to support commands from SSH without dropping you to the shell. You probably don't need to use Expect at all:
#!/usr/bin/perl use strict; use warnings; use Net::OpenSSH; $| = 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 $out = $ssh->pipe_out("show ip arp") or die "unable to run remote command show ip arp"; while(<$out>) { print "$. $_" }