Besides redirecting to STDERR within the program, you can also redirect it from the shell if you run it at the commandline.
In both Linux and Windows, you can do this:
c:\perl_program.pl 2> error.log
or
$./perl_program 2> error.log
This allows you to change the error file on the fly, or see it onscreen without changing the code. You can redirect STDOUT the same way, just leave off the 2 (or use 1; same thing).