use Net::SSH::Perl; use strict(); my $host = ""; my $user = ""; my $password = ""; #-- set up a new connection my $ssh = Net::SSH::Perl->new($host,debug=>1,use_pty=>1); #-- authenticate $ssh->login($user, $pass); #-- execute the command my($stdout, $stderr, $exit) = $ssh->cmd("ls -l /home/$user");