$out = $ssh->capture({stdin_data => <open2socket; print $socket "ls\n"; while (<$socket>) { print }; waitpid($pid, 0);