#!/user/bin/perl
$max = '30';
$len = '50';
@arey = ('|', '/', '-', '\', '');
for ($num = 0;$num<=$max;$num++) {
local $| = 1;
$percent = int(($num/$max)*100);
$print = "["."%-"."$len"."s"."] "."%d%%"."r";
$bar = '*' x int(($percent/100)*$len);
if (int(($percent/100)*$len) < $len) {$bar .= @arey[$percent % 4];}
printf ($print,"$bar","$percent");
sleep(1);
}
print "nSuccess!n";
友人より教えていただいたソースを参考に*がクルクルするプログレスバーを作成しました。
※Time::HiResを使うと良いかもしれません。
0 Comments.