#! / Usr / bin / perl use strict; use Net::SSH::Expect; my $ssh = Net::SSH::Expect->new ( host => "xx.xx.xx", password=> 'passwd', user => 'usr', raw_pty => 1, timeout => 10 ); my $login_output = $ssh->login(); if ($login_output !~ /#/) { die "Login has failed. Login output was $login_output"; } print $login_output; my $who = $ssh->exec("show version"); print ($who); $ssh->close();