in reply to Odd perl/ssh interaction

I THINK what is happening is that that form of open means your perl program and ssh share the same STDIN. And that ssh is the one flushing STDIN.

But i cant find a reference to this right now. I do know that if you didnt redirect STDOUT (and/or STDERR) your perl program and ssh share those two files as well

What might test that is  open(H, "echo '' | ssh $_ 'uptime' 2>&1 |");. In that case the shell is redirecting the STDIN of ssh

edit:another way to test this theory (redirecting the STDIN of ssh) would be  open(H, "ssh $_ 'uptime' </dev/null 2>&1 |");.

Replies are listed 'Best First'.
Re^2: Odd perl/ssh interaction
by mlf (Initiate) on Jul 08, 2017 at 13:33 UTC
    Yes, you hit the nail on the head. Ultimately adding -n to the ssh command, as suggested by haukex below, is the simplest solution.

    Thanks for the help!