您的位置:首页 > 其它

perl学习笔记八——文件读写

2015-03-05 20:49 267 查看
一,perl对文件读写的处理

点击打开链接

检查当前目录下是否有test.pl的文件,如果有则提示:

@test=`dir 2>&1`;
if (open(MYFILE, ">>cycle5_log.txt")) {
print MYFILE (@test);
}
else{
print "creat new file error!\n";
}
$testout = @test;
if($testout > 0)
{
foreach $testr (@test)
{
#print $testr;
if ($testr =~ m/test.pl/)
{
print "test.pl is exist";
}
}
}
close(MYFILE);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: