It is probably better to say { #limit the scope of the change to $| local($|) = 1; while (1) { $count++; print "${count}\r"; } }
On Fri, 2002-02-08 at 13:36, Jason Purdy wrote: > I saw this too and immediately thought of flushing... > > Try adding this before you go into the while loop: > $|++; > > Jason > > If memory serves me right, on Friday 08 February 2002 12:50, James Kelty > wrote: > > While looking over the 'print over prior print' thread, I found that, as it > > should be, perl will print out as fast as it can. Below code > > > > #!/usr/bin/perl -w > > > > $count = 1; > > > > while(1) { > > $count++; > > print "${count}\r"; > > } > > > > So? Great, right? Well, what if I want to slow if down with a sleep() > > statement? > > > > #!/usr/bin/perl -w > > > > $count = 1; > > > > while(1) { > > $count++; > > print "${count}\r"; > > sleep(1); > > } > > > > From what I have done using perl 5.4.x, I was able to do things like this. > > But it seems that perl 5.6.0 will just sleep and not print anything out. > > Can someone explain why? And can some one explain how to slow the while > > loop down a bit if not using sleep()? > > > > Thanks! > > > > -James > > > > > > James Kelty > > Sr. Unix Systems Administrator > > The Ashland Agency > > 541.488.0801 > > [EMAIL PROTECTED] > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- Today is Prickle-Prickle the 39th day of Chaos in the YOLD 3168 Or not. Missle Address: 33:48:3.521N 84:23:34.786W -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]