E:\primes>perl -Mstrict -wE"BEGIN{ open STDOUT, '>&STDERR';} say 'hi'; warn 1; say 'this is fun'; warn 2; say 'bye'" 2>log C:\test>type log hi 1 at -e line 1. this is fun 2 at -e line 1. bye