Thanks for your suggestions Joost. I had already tried the die "......$!" before I posted my original message. It didn't help because I'm testing this on a web server, through a browser, and the page I'm generating just terminates at the point of error without reporting the error. I also don't seem to have access to the error_log on this particular (institutional) server.
Tilly (see below) hit on the cause of the problem. Just to follow up on your suggestion, I ran the script from a command line and got another confirmation that it was the taint checking:
Insecure dependency in unlink while running with -T switch at ./de
+lete.cgi line 43.
Thanks again.