http://qs1969.pair.com?node_id=1068345


in reply to Early termination of STDIN with combination of ssh and sleep

Does it work if you change the exec to

die "Unable to exec\n" unless(exec("/usr/bin/ssh localhost /bi +n/sleep 10 </dev/null"));

or

die "Unable to exec\n" unless(exec("/usr/bin/ssh -n localhost +/bin/sleep 10"));

IIRC ssh may be pre-reading STDIN and then discarding the contents when it's not actually needed. Redirecting stdin for the ssh command makes sure there won't be any interference with your main program.