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


in reply to print or die?

I've never felt the need to test every print statement when writing to files and so far I've never come across a situation where the print statement failed, but there are rare cases where it can occur.

If I were going to go down that path, I'd write a sub (lets call it printing) that accepted at least 2 parameters; the first being the filehandle and the rest the data to be printed. Then do the print statement and apply whatever error handling I deemed appropriate (warn or die), which would probably also include the use of the caller() function.