在我的脚本中,与我已经拥有的一组数据相比,我检查元素是否存在,我多次执行此操作,因此是进度条。
这就是我现在正在做的事情
### A loop which is done multiple times ###
my $i =1;
my $page = 50;
while ($i <= $page)
{
##### Part where I print my progress bar ######
print "\rProgress:[";
my $completed =($i/$page)*100;
$completed = ceil($completed);
my $l= $completed;
while ($l>0){
print "#";
$l--;
}
my $remaining = 100-$completed;
while ($remaining>0){
print " ";
$m--;
}
print "] ";
print $completed . "% Complete";
######### Part where I check and keep count #############
foreach (@each_job)
{
my $temp = $_;
# Count number of jobs that exist with my set
if ($job{"$temp"} == 1)
{
$does_exist++ ;
## print "\n Exists - $does_exist"; #Confused for this print
}
else
{
$does_not_exist++;
## print "\n Does not exist - $does_not_exist"; #Confused for this print
};
};
$i++;
}
所以我目前得到的是
Progress:[################################################ ] 48% Complete
哪个工作正常并将进度条显示为逐页遍历。但我想要的是这样的 -
Progress:[################################################ ] 48% Complete
Exists - 3
Does Not Exist - 5
它会在同一个地方不断更新(使用\r
)。有人能帮我吗 ?