[ale] Thanks!!! -- RE: [ale] perl, *nix, or user error

Cade Thacker linux at cade.org
Wed Apr 3 18:00:30 EST 2002


That was exactly it!! My little script turned out pretty good. It is
pretty simple, but you have to start somewhere right? All it does is print
output from 'nfrm' then count down to zero and refresh.  Open up a
terminal, start this puppy up,  then just check it out every once in a
while. (this way it holds my ssh connection open so it would time out ;)

Once again, thanks, that was it!

********************* BEGINING OF SCRIPT ************************
#!/usr/bin/perl -w

use strict;

$| = 1;

while (1)
{

        system "clear";
        system "nfrm";

        my $count = 30;
        while ( $count > 0 )
        {
                printf "%2d", $count;
                sleep 1;
                $count--;
                print "\b\b";
        }
}

********************* BEGINING OF SCRIPT ************************


cade was here






On Wed, 3 Apr 2002, John Wells wrote:

> Your output is most likely being buffered.
>
> Setting $| = 1 should do it....
>
>
> ---------  Original message --------
> From: Cade Thacker <linux at cade.org>
> To: ale at ale.org <ale at ale.org>
> Subject: [ale] perl, *nix, or user error
> Date: 04-03-02 21:53
>
> > Ok, I have tried this on FreeBSD, Linux, and HP-UX.  A very simple script
> that I can not seem to make work the way I want.
>
> ********************* BEGINING OF SCRIPT ************************
>
> #!/usr/bin/perl -w
>
> print &quot;Hello World &quot;;
>
> $counter = 0;
> while ($counter &lt; 10)
> {
> print &quot;$counter &quot;;
> $counter++;
> sleep 1;
> }
>
> ******************* END OF SCRIPT **********************
>
> OK, I expect it to print Hello World, then 0-9 at 1 second intervals, all
> on the same line, instead it prints it all out at once, 10 seconds after
> starting the program.
>
> It will print things out one at a time if I put a 'n' at the end of any
> 'print' lines, but I want the count on one line.
>
> Can anyone help? Do I need to flush the buffer or something?
>
> cade was here
>
>
> ---
> This message has been sent through the ALE general discussion list.
> See http://www.ale.org/mailing-lists.shtml for more info. Problems should be
> sent to listmaster at ale dot org.
>
>
> ---
> This message has been sent through the ALE general discussion list.
> See http://www.ale.org/mailing-lists.shtml for more info. Problems should be
> sent to listmaster at ale dot org.
>
>


---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.






More information about the Ale mailing list