use Net::OpenSSH; my $ssh = Net::OpenSSH->new($remote_host, user => $remote_user, password => $password); $ssh->error and die "Unable to connect to $remote_host: " . $ssh->error; my $fh = $ssh->pipe_out('ls -la /Users/vortura') or die "unable to run command: " . $ssh->error; while (<$fh>) { print "OUT: $_"; } close $fh or die "close failed: $?";