我写了以下程序
if(open(DATA , ">dddddddd")){
print "creating dddddddd";
close(DATA);
}
else{
print "cannot create";
}
print "going to sleep";
sleep (10);
print "unlinking dddddddd";
unlink "dddddddd";
现在而不是将输出作为
creating dddddddd
going to sleep
and after 10 seconds printing
unlinking dddddddd
程序执行时会休眠10秒,输出如下
creating dddddddd
going to sleep
unlinking dddddddd.
任何人都可以解释????
答案 0 :(得分:4)
答案 1 :(得分:0)
我们的打印字符串后没有回车符,因此输出可能是缓冲的。你应该添加回车。
例如:
print "creating dddddddd\r\n";
或者只是:
print "creating dddddddd\n";