Re: Buffer output?

2002-07-23 Thread zentara

On Mon, 22 Jul 2002 10:40:29 +0300, [EMAIL PROTECTED] (Octavian Rasnita)
wrote:

Hi all,

I've seen the following line in more Perl scripts and even in some Perl
books, but it wasn't very well explained.

$|=1;   ## Don't buffer output

What does it mean to buffer output?
Which is the difference if the  $| is 0 or 1?

If you want a nice demo of the buffering problem, run
this:
###
#!/usr/bin/perl
#without a newline, it won't print
#until the buffer is 2k

#$|=1;  # try it with and without this line commented :-)

while (1){
print 'aa';
select(undef,undef,undef,.03);
}




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Buffer output?

2002-07-22 Thread Octavian Rasnita

Hi all,

I've seen the following line in more Perl scripts and even in some Perl
books, but it wasn't very well explained.

$|=1;   ## Don't buffer output

What does it mean to buffer output?
Which is the difference if the  $| is 0 or 1?

Thank you.

Teddy Center: http://teddy.fcc.ro/
Mail: [EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Buffer output?

2002-07-22 Thread fliptop

Octavian Rasnita wrote:

 
 I've seen the following line in more Perl scripts and even in some Perl
 books, but it wasn't very well explained.
 
 $|=1;   ## Don't buffer output
 
 What does it mean to buffer output?
 Which is the difference if the  $| is 0 or 1?


perldoc perlfaq5


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Buffer output?

2002-07-22 Thread perl-dvd

Teddy,
$|=1; is supposed to perl to print to standard out right away instead of buffer 
information.
You see, by default Perl buffers what it is going to print out until the buffer is 
full, then
prints.
For some reason, when I use $|=1; It seems that the first output to STDOUT is 
buffered, but once
it prints the initial buffered part, everything after that is printed immediately.

Regards,
David


- Original Message -
From: Octavian Rasnita [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, July 22, 2002 1:40 AM
Subject: Buffer output?


Hi all,

I've seen the following line in more Perl scripts and even in some Perl
books, but it wasn't very well explained.

$|=1;   ## Don't buffer output

What does it mean to buffer output?
Which is the difference if the  $| is 0 or 1?

Thank you.

Teddy Center: http://teddy.fcc.ro/
Mail: [EMAIL PROTECTED]



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]