[ale] perl, *nix, or user error

Cade Thacker linux at cade.org
Wed Apr 3 16:27:02 EST 2002


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 "Hello World ";

$counter = 0;
while ($counter < 10)
{
        print "$counter ";
        $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.






More information about the Ale mailing list