C:\Users\Corion>perl -le "warn 'foo';print 'bar'"
foo at -e line 1.
bar
C:\Users\Corion>perl -le "warn 'foo';print 'bar'" >tmp.txt
foo at -e line 1.
C:\Users\Corion>perl -le "warn 'foo';print 'bar'" 2>&1 >tmp.txt
foo at -e line 1.
C:\Users\Corion>ver
Microsoft Windows [Version 6.1.7601]
C:\Users\Corion>
Update: And I think I've been using the shell direction wrong, because it understands it if I redirect the filehandles in a different order:
C:\Users\Corion>perl -le "warn 'foo';print 'bar'" >tmp.txt 2>&1
C:\Users\Corion>type tmp.txt
foo at -e line 1.
bar
I always think "First, redirect filehandle 2 to filehandle 1, then redirect the output to filehandle 1 to a file.". But that this is wrong and I need to do it the other way around. |