私のスクリプトでは、すでに持っているデータのセットと比較して要素の存在をチェックします。これを複数回実行するため、プログレスバーが表示されます。
これは私が今していることです
### 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
)。誰かが私を助けることができますか?