7
4月
0
perlで改行せずにカウントダウンさせる
つい最近知ったのですが、UNIXではCR(\r)は行頭に戻るという意味だったのね( ´ー`)
#!/usr/bin/perl
$| = 1;
for (my $C = 1,my $D = 30; $C < = $D; $D--) {
print "Please wait for " . sprintf("%02d",$D) . " seconds more";
sleep 1;
print "¥r";
}
exit;
↑をコンソール上で実行すると改行しないでカウントダウンしてくれます。
Enjoyed reading this post?
Subscribe to the RSS feed and have all new posts delivered straight to you.
Subscribe to the RSS feed and have all new posts delivered straight to you.
Post your comment
