Adding progress bars in Perl script
A sample Perl script to implement progress bar
#!/bin/perl
# Total from which percentage will be calculated
$cnt = 16;
for($i=0;$i<$cnt;$i++) {
# Calculate Percentage
$percent = ($i/$cnt)*100;
# Print Progress
for($k=0;$k<$percent;$k=$k+5) {
print "*";
}
print " [ $percent% Complete ] ";
# Goto the start of the line
print "\r";
sleep 1;
}
print "\r";
print ">>>>>>>>>>---------100% Complete---------<<<<<<<<<<\n";
Add new comment