HP3000-L Archives

November 1996, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Reply To:
Date:
Wed, 20 Nov 1996 08:21:13 EST
Content-Type:
text/plain
Parts/Attachments:
text/plain (19 lines)
The solution to the problem with Perl and my program output comming back before
a previous print, is due to the same type of output buffering that C uses.  In
order to prevent this, you need to tell perl that the output file is to be 'hot
piped', or in other words, all output to the output file will be flushed
immediately.  To do this, add the following to your script:

$| = 1;

That is it!  The $| is perl's way of setting the buffering option to the CURRENT
output file.  Note that you may change your current output file, but that is
another lesson.  :-)  Setting the value to '0' will use the default I/O
specifications for buffering.  Using the value of '1' will automatically post
any output to the file WITHOUT buffering it.

Thanks to Craig Vespe and Jeff Kell for information that sent me in the right
direction!

Kevin Newman

ATOM RSS1 RSS2