#!/bin/perl use Net::SSH::Expect; my $ssh = Net::SSH::Expect->new ( host => $host, password=> $pass, user => $user, raw_pty => 1, timeout => 3 ); my $login_output = $ssh->login(); if ($login_output !~ />/) { die "Login has failed. Login output was $login_output"; } my $who = $ssh->send("show config\n"); while ( defined ($line = $ssh->read_line()) ) { print $line . "\n"; } close $line; $ssh->close();