Re: [OT?] sleep()-problem in perl
On Mon, Nov 11, 2002 at 05:08:55PM +0100, Johannes J?rg wrote:
> Could someone tell me why this works:
>
> #!/usr/bin/perl -w
> for ($i=0;$i<=10;$i++){
> print "sleeping...\n";
> sleep 1;
> }
>
> and this one does not:
>
> #!/usr/bin/perl -w
> for ($i=0;$i<=10;$i++){
> print "sleeping...";
> sleep 1;
> }
Standard output is usually line buffered when printing to a terminal, so
your output may not appear until you print a newline. Set $| = 1 if you
want to change this, and see perlvar(1).
Cheers,
--
Colin Watson [cjwatson@flatline.org.uk]
Reply to: