my $ssh = Net::OpenSSH->new( $remote_host, ( ssh_cmd => '/usr/local/bin/ssh', user => $user, password => $pass ) ); my $command = '/bin/ls -l'; my ($out, $err) = $ssh->capture2($command); chomp $out; undef $ssh;