一,perl对文件读写的处理
@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);