perl学习笔记八——文件读写
发布时间:2020-12-15 23:47:01 所属栏目:大数据 来源:网络整理
导读:一,perl对文件读写的处理 点击打开链接 检查当前目录下是否有 test.pl 的文件,如果有则提示: @test=`dir 21`;if (open(MYFILE,"cycle5_log.txt")) {print MYFILE (@test); }else{ print "creat new file error!n";}$testout = @test;if($testout 0){ for
一,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); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |