in reply to Re: Speed comparison between printing to STDOUT and printing to a filehandle
in thread Speed comparison between printing to STDOUT and printing to a filehandle

Technical nit. Printing to STDOUT is not always line buffered. If it can, Perl will check whether STDOUT is an interactive terminal, and will make it line buffered if it is, and otherwise will not.

You can verify this for yourself under Unix by comparing the output of the following two commands:

perl -e 'print "hi\n" while sleep 1' perl -e 'print "hi\n" while sleep 1' | perl -pe 1
  • Comment on Re^2: Speed comparison between printing to STDOUT and printing to a filehandle
  • Download Code