[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bash, perl, C

On Sat, Jan 08, 2005 at 12:18:33AM +0100, Gerard Robin wrote:
> I think that my question was not very clear.
> timerest3.pl in fact is a subroutine in a little script Perl that I wrote 
> myself ( I am not a student who expect that others do his work :-))
> In that subroutine I wrote
> ......
> while ($i < 6) {
> print "\e[0;46;31m", 5-$i, "\e[0m";
> `sleep 1`; # the sleep of the shell
> print "\r";
> .......
> If i use the sleep of Perl there nothing is displayed at though with the sleep 
> of the shell the numbers 5 4 3 2 1 0 are displayed as I want.
> And, I don't understand why the sleep of Perl doesn't work ?
> I think it is not coherent to use the sleep of the shell whereas Perl has such 
The sleep function is working as you expect, it is the output that is
buffered.  Look at the perl info for the $| variable.  (Hint: set $| to
a non-zero value for unbuffered output.)

(Not a perl guru, but I think this is what you want.)

Chris Harris <charris@rtcmarketing.com>
GNU/Linux --- The best things in life are free.

Reply to: