in reply to Re: Trying to make a simple countdown timer
in thread Trying to make a simple countdown timer

Ok good I think I overlooked how the printing to STDOUT is buffered by default, thanks for that. Problem solved. But I would only want the change of $| to 1 to affect that function, and when it exits I want $| back to default. Would this do that?
sub countdown { local $| = 1; my $int = $_[0]; while ($int > 0) { print "$int ... "; sleep 1; $int--; } print "\n"; }
*edit* just tried and seems to work as expected.