- 论坛徽章:
- 0
|
Perl新手求指导,下面的一段代码运行不报错,但就是写不进文件,文件里不出任何东西,这是为什么啊?求指导,谢谢!
#!usr/bin/perl -w
use strict;
my @array;
my $array;
my %hash;
my $value_arr;
open IN,'<C:\Users\lenovo\Desktop\Perl_Resolution\Level1\24.foldChangeFilter\DECountsTable4vs5.txt'
or die "Can't open the file: $!";
while(<IN>)
{
chomp();
s/\r//g;
if(/Accession/)
{
next;
}
my($id,$value,undef,undef,undef,undef,undef) = split(/\s+/,$_,7);
}
close IN;
open OUT1,'>C:\Users\lenovo\Desktop\Perl_Resolution\Level1\24.foldChangeFilter\output1.txt'
or die "Can't write the file: $!";
open OUT2,'>C:\Users\lenovo\Desktop\Perl_Resolution\Level1\24.foldChangeFilter\output2.txt'
or die "Can't write the file: $!";
foreach my $k(keys %hash)
{
my $value_arr = $hash{$k};
if($value_arr > 0.5 and $value_arr < 2)
{
print OUT1 "$k\t$value_arr\n";
}
else
{
print OUT2 "$k\t$value_arr\n";
}
}
close OUT1;
close OUT2;
|
|