Re: Why doesn't this work?
- From: Jürgen Exner <jurgenex@xxxxxxxxxxx>
- Date: Thu, 20 Aug 2009 12:14:43 -0700
HerbF@xxxxxxxxxxxxx wrote:
Glenn Jackman wrote:
At 2009-08-20 02:08PM, "HerbF@xxxxxxxxxxxxx" wrote:
I'm trying to write a simple routine to print a character every second. I
have:
foreach (1..5) {
print "*";
sleep 1;
}
When I run it, it waits for the full 5 seconds to tick by, and then prints
the string '*****'. Why doesn't it print an asterisk every second until
finished?
Your output is buffered. Set $|=1 first.
Tried that, but it made no difference.
Then something else is buffering on top of Perl's buffering. See
'perldoc -q buffer' for some in-depth discussion and for other ways to
work around buffering.
jue
.
- References:
- Why doesn't this work?
- From: HerbF
- Re: Why doesn't this work?
- From: Glenn Jackman
- Re: Why doesn't this work?
- From: HerbF
- Why doesn't this work?
- Prev by Date: Re: Error uninitialized value
- Next by Date: Re: Why doesn't this work?
- Previous by thread: Re: Why doesn't this work?
- Next by thread: Re: Why doesn't this work?
- Index(es):
Relevant Pages
|