in reply to Re: Printing Warning Messages Into a File
in thread Printing Warning Messages Into a File

$ perl mycode.pl 2>1 1> debug.txt

No, that's broken in two ways. First, you are missing an ampersand... (which means your errors are going into the file ./1.) After you fix that, you'll still see the error. Pop quiz: Why?

Order matters. You have to redirect stdout before stderr... because otherwise stderr points to the old stdout while stdout points to the file.

-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re^3: Printing Warning Messages Into a File
by Errto (Vicar) on Oct 28, 2005 at 02:57 UTC
    God, I always wondered why that was and I keep getting it wrong. (the part in the spoiler I mean) But your explanation makes sense!