http://www.perlmonks.org?node_id=1050922


in reply to Net::OpenSSH stdout_fh problem

You are running the remote commands in the background and not waiting for then to finish before reading the output file.