#!/usr/bin/perl use strict; use warnings; use diagnostics; use Net::OpenSSH; use Expect; my $host = '10.0.0.1'; my $ssh = Net::OpenSSH->new("$host", timeout => 30); $ssh->error and die "unable to connect to remote host: ". $ssh->error; my ($pty,$pid) = $ssh->open2pty or die "unable to run remote command show ip arp"; my $output = $ssh->capture({stdin_data => "term length 0\nterm width 512\nsh ver\nsh run\nexit\n"}); print $output; #### Pseudo-terminal will not be allocated because stdin is not a terminal. channel 4: open failed: resource shortage: