Harold Castro <[EMAIL PROTECTED]> wrote:
: my $countdown = 5;
: while ($countdown > 0){
: print "\.";
No need to escape the period in a double quoted string.
: sleep 1;
: $countdown--;
: }
: print "Kaboom!!"
:
: And the result..
: after waiting for 5 seconds, it displayed this line at once:
:
: .....Kaboom!!
:
:
: Why does this happens with a while loop?
By default, perl buffers output. Nothing is printed until
the buffer fills or the script ends. You can change this
behavior by setting $| to 1.
$| = 1;
my $count_down = 5;
while ( $count_down-- ) {
print '.';
sleep 1;
}
print "Kaboom!!"
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>