Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
We mentioned earlier that if you were to reopen a filehandle
(that is, if you were to open a filehandle FRED when you’ve already got an open
filehandle named FRED), the old one
would be closed for you automatically. And we said that you shouldn’t
reuse one of the six standard filehandle names unless you intended to
get that one’s special features. And we also said that the messages from
die and warn, along with Perl’s internally generated
complaints, go automatically to STDERR. If you put those three pieces of
information together, you now have an idea about how you could send
error messages to a file, rather than to your program’s standard error
stream:[165]