title: Perl Print function does not work properly when Sleep() is used
body: <p>I have the following code to print a "." each second to simulate a progress bar.</p>
  
  <pre><code>$num = 15;
  while($num--){
      sleep(1);
      print ".";
  }
  </code></pre>
  
  <p>The problem I'm having now is the "." character is not printed after each loop. Instead, all 15 "." are printed at once after the loop exits. However if I print ".\n", it works fine. But the "." will be printed on a new line every time which is not what I want.</p>
  
  <p>It seems quite weird and could not figure out why. Could anyone provide some help? Thank you.</p>
  
  <p>Regards,
  Allen </p>