in reply to open with pipe

That will read until the pipe is closed, which is usually when the program ends, but it could be earlier.

close($out) (done implicitly when $out goes out of scope) will wait for the program to end. It won't cause the program to end, though.