一,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);