in reply to print or die
How about:
eval {print FILE <<UNTIL_I_SAY_STOP; blah, blah, blah UNTIL_I_SAY_STOP }; $@ && die "$@"; [download]
That assumes $|=1;. If autoflush is not on you'll see errors on close rather than after print.
After Compline,Zaxo