美文网首页
Perl处理文件及文件夹

Perl处理文件及文件夹

作者: 潘高PG | 来源:发表于2019-03-08 13:34 被阅读0次

前言

更多内容,请访问我的 个人博客


use FindBin qw($Bin);

#遍历文件夹
my $fileReportDir = $Bin;   #出报告所在的文件夹地址
if(-e $fileReportDir){
opendir DIR, $fileReportDir || die "Error in opening dir $fileReportDir\n";
while( my $file = readdir(DIR)){
next if $file eq ".";
next if $file eq "..";
my $fileAll = $fileReportDir."/".$file;
if(!unlink($fileAll)){
print "=====程序终止!=====\n删除表格(".$fileAll.")失败,请手动删除\n";  
#保留黑框
system pause;
#程序停止运行
die;
        }
     }
     closedir DIR;
}

#读取文件内容
open FILE, "<$file" || die "Not Found file: $file\n";
while (<FILE>){
my ($gene,$chr) = (split /\t/,$_)[0,1];
}
close FILE;

相关文章

网友评论

      本文标题:Perl处理文件及文件夹

      本文链接:https://www.haomeiwen.com/subject/rtrrpqtx.html