How to stop print newline with autoflush handle on?

D

David

use strict;
use warnings;

$| = 1;

for ( 1 .. 5 )
{
print ".";
sleep 1;
}

the code prints:
..
..
..
..
..

without $| , it will print out: ..... How can I get the behavior of $|
without the newline?
Thanks for the help.

David
 
P

Peter J. Acklam

David said:
use strict;
use warnings;

$| = 1;

for ( 1 .. 5 )
{
print ".";
sleep 1;
}

the code prints:
.
.
.
.
.

Well, it shouldn't, if the above is all your code. All the dots
should be printed on the same line. And they are, on my computer.
I am using Cygwin on Win2K. You are using ActivePerl on Windows?

Peter
 
D

David

Yes, I'm using Active perl on Windows XP Pro.

Peter J. Acklam said:
Well, it shouldn't, if the above is all your code. All the dots
should be printed on the same line. And they are, on my computer.
I am using Cygwin on Win2K. You are using ActivePerl on Windows?

Peter
 
P

Peter J. Acklam

David said:
Yes, I'm using Active perl on Windows XP Pro.

It seems like a bug to me. Or perhaps something with the shell.
I don't see how you make perl get around this.

Peter
 
P

Peter Wyzl

: use strict;
: use warnings;
:
: $| = 1;
:
: for ( 1 .. 5 )
: {
: print ".";
: sleep 1;
: }
:
: the code prints:

I run Activeperl on Windows XP Pro and get ..... with that code cut and
pasted...

P
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top