使用perl来判断文件是否存在

来源:互联网 发布:音乐cms 编辑:程序博客网 时间:2024/05/21 08:41


使用perl判断某文件是否存在:

#!/usr/bin/perl -wmy $file = "/home/zl/study/perl/fileexist/t.txt";if(-e $file){print "t.txt exist. \n";}else{print "do not exist. \n";}
判断成功后,可以在继续对文件做其他处理。

参考 : http://bbs.chinaunix.net/thread-1866833-1-1.html


0 0