#!/usr/bin/perl use Net::SSH::Expect; my $ssh = Net::SSH::Expect->new ( host => "10.0.0.1", port => "22", user => "testuser", password => "testpassword", raw_pty => 1, timeout => '4', #log_file => "$TempLogFile" ); my $login_output = $ssh->login(); if ($login_output !~ /#/) { die "Login has failed. Login output was $login_output"; }; $ssh->exec("terminal width 512"); $ssh->exec("terminal length 0"); my @Output = $ssh->exec("sh run"); print "@Output\n"; $ssh->close();