in reply to Re: How do I output error messages to a file?
in thread How do I output error messages to a file?

The OP will want to ammend their code to print the errors to STDERR so that they can be redirected with >2 output.txt. Normal output is still printed to STDOUT (usually the console).

E.g.

print STDERR "This didn't work as expected!\n";

Replies are listed 'Best First'.
Re^3: How do I output error messages to a file?
by gellyfish (Monsignor) on Jan 26, 2005 at 12:21 UTC

    I think the OP was talking about warnings and/or strict errors, which already do go to STDERR but yes if they want to catch their own messages then these will have to be either explicitly printed to STDERR or output with warn.

    /J\