I am trying to print progress in % in command prompt. But it is not working properly.
I want to print the progress as :: Status 10% Completed when 20% will complete it will show Status 20% Completed in that same place not in new line. Could you please help me.
Code::
$count++;
$per=($count/$total)*100;
print "\nStatus: $per Completed.\r";
sleep 1;
Small modification to the original code: \n and \r are removed and added autoflush and "\033[G" and \033[J
The module Term::ProgressBar seems to be able to do what you're after.
Note, I haven't tried it.
Edit Well, out of curiosity, I have now tried a small script:
It won't exactly print what you asked (eg
Status nn% completed
), instead, it does print a real progress bar, something likeNevertheless, it seems to most simple and straight forward solution.
You can do something like this: