Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: $++ Does What, Exactly?by extremely (Priest) |
on Feb 10, 2001 at 11:36 UTC ( [id://57598]=note: print w/replies, xml ) | Need Help?? |
Are you on Unix? (not sure how WinXx reacts) Try this:
The total output of the first for loop is smaller than the print buffers on most machines. You'll wind up with the lines out of order from what you'd expect because the data isn't actually written until the close flushes the buffer to disk. With both the filehandles set to autoflush, the lines alternate the way you would expect. The benefit to caching is that you get better disk performance. The benefit to flushing is that you get the data written immediately. That can be a big deal if you have multuple time sensitive programs writing to one log file. Imagine if a webserver left caching on while writting the log. you'd get chunks of lines in order from each httpd child and then flip back 3 seconds for the next child's data rather than a smooth temporal stream of requests. Very ugly. --
In Section
Seekers of Perl Wisdom
|
|