Jonathan Mast wrote:
We have a socket server that, in addition to serving data, also writes
logging statements to a file.

My question concerns the correctness of how it accesses the log file.  The
script is running continuously and all the log file IO stuff is inside the
main 'while' loop.
The file is opened, written to and closed during each iteration of the
loop.  This seems very inefficient to me, all the opening and closings I
presume are IO intensive.
Would placing the opening and closing of the filehandle outside the while
loop be a good idea?

Yes.  You should probably also autoflush the filehandle.

perldoc -q flush



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to