use Net::SSH::Expect; use strict; use warnings; #login to a remote host my $ssh = Net::SSH::Expect->new (host => "ipaddr", password=> 'pwd', user => 'username', raw_pty => 1); my $login_output = $ssh->login();