Hey everyone! I have done it again....Run into a problem. Im trying to create a "Twirlling baton" progress indicator, but all the output from this script comes up after it runs, and prints to STDOUT> Can anyone tell me how to fix this to make it appear to be a twirlling baton?
#!/usr/local/bin/perl -w
use strict;
my $timer = 180;
printf(STDOUT "Please wait.\n This could take several minutes.\n");
#initialize the time to 1 and the twirl to 1
my $time = 1;
my $count = 1;
while($time != $timer){
if ($count == 5){$count = 1;}
for ($count){
/1/ and do { printf(STDOUT "-\b"); };
/2/ and do { printf(STDOUT "\\\b"); };
/3/ and do { printf(STDOUT "|\b"); };
/4/ and do { printf(STDOUT "\/\b"); };
}# - for ($count)
sleep 1;
$count++; #increment the count and sleep timer.
$time++;
}
print "Count done.";
#!/usr/local/bin/perl -w
use strict;
my $timer = 180;
printf(STDOUT "Please wait.\n This could take several minutes.\n");
#initialize the time to 1 and the twirl to 1
my $time = 1;
my $count = 1;
while($time != $timer){
if ($count == 5){$count = 1;}
for ($count){
/1/ and do { printf(STDOUT "-\b"); };
/2/ and do { printf(STDOUT "\\\b"); };
/3/ and do { printf(STDOUT "|\b"); };
/4/ and do { printf(STDOUT "\/\b"); };
}# - for ($count)
sleep 1;
$count++; #increment the count and sleep timer.
$time++;
}
print "Count done.";