#!/usr/bin/perl

$| = 1;                         # turn off buffering

$s = 0;
my $length = 43;
while (1) {
  my $nd = int($s/100 * $length);
  my $nu = $length - $nd;
  my $str = '|' . ('*' x $nd) . ('.' x $nu) . '|';
  print $str, "\r";
  sleep 1;
  last if $s >= 100;
  $s += rand(20);
  $s = 100 if $s > 100;
} 

print "\n";

