我有以下代码:在Perl的正则表达式编译使用未初始化值的
use strict;
use warnings;
use IO::File;
use Bio::SeqIO;
my ($file1) = $ARGV[0];
my ($file2) = $ARGV[1];
my $fh1 = IO::File->new("$file1")|| die "Can not create filehandle";
my $fh2 = IO::File->new("$file2")|| die "Can not create filehandle";
my @aligned_array =();
while(my $line1 = $fh1->getline){
chomp($line1);
if (($line1 =~ /^match/)||($line1 =~ /^-/)) {
next;
}
else {
my @line_array = split(/\s+/, $line1);
push(@aligned_array, $line_array[9]);
}
}
my $fio1 = IO::File->new("> chimeric_contigs.txt")|| die "Can not create filehandle";
while(my $line2 = $fh2->getline) {
my $count = 0;
chomp($line2);
for my $aligned (@aligned_array) {
# print $line2.$aligned."\n";
if ($line2 =~ m/$aligned/) {
$count++;
}
}
if ($count >= 2) {
print $fio1 $line2."\n";
}
}
$fio1->close;
和我不断收到同样的错误
使用未初始化值的正则表达式编译在/ gscuser/rfujiwar /箱/find_chimeric_contigs_blat.pl线41
这是线41:如果($ LINE2 =〜米/ $对齐/){
两个$ LINE2及$对齐的定义,因为我可以p他们没有问题。请帮忙。
你打印它们时会得到什么? –
,我期待 – Ryan
Contig0.3Contig872.1 Contig0.3Contig872.1 Contig0.3Contig872.1 Contig0.3Contig872.1 Contig0.3Contig873.1等正确的琴弦......这就是取消注释#打印的结果$ LINE2 $对齐 “\ n”。 – Ryan