in reply to Perl 5.8: warn sometimes writes to STDOUT?

With ActiveState perl 5.8.4 on Win and Slackware's 5.8.0 and 5.8.4, your code produces the same results: the warn statements go to main::STDOUT, and the print statement produces an error on main::STDOUT.

From perldoc -f print:

... If FILEHANDLE is omitted, prints by default to standard output (or to the last selected output channel--see "select"). ...
So I added some debugging statements like so:
$fh = select; print("currently selected FILEHANDLE:$fh\n");
which gives:
#2: warning at C:\warntest.pl line 16. #4: warning at C:\warntest.pl line 28. currently selected FILEHANDLE: main::STDOUT #4: STDOUT is open currently selected FILEHANDLE: main::STDOUT print() on closed filehandle STDERR at C:\warntest.pl line 34. currently selected FILEHANDLE: main::STDOUT #4: warning at C:\warntest.pl line 37. currently selected FILEHANDLE: main::STDOUT
Hope this helps.