$ perl -we'open FOO, q<| sh -c "sleep 5;exit 123"> or die; print "closing:\n"; close FOO; print $? >> 8' closing: 123