Below is my script, When I run the script, everything is ok.
#! /usr/bin/perl âw
print "111\n"; warn "222 \n";
Problem emerges when using the following command line under csh, $test.pl >& test.log
Where test.log is like: 222 111
However, what I experted is: 111 222
Do you guys have any idea about that? Thanks a lot.
C<print> goes to stdout which is buffered for efficiency, while C<warn> and C<die> go to stderr which is not buffered so that errors are displayed immediately.
You should be able to see it on any terminal with
print '1'; warn '2';
(the newlines sometimes force flushing of the buffer)
You can unbuffer stdout with:
$| = 1; print '1'; warn '2';
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>