1
下面是代碼Perl中得到數組值不是內存地址
open IN, '</root/Desktop/out.txt' or die "Cannot open file : $!";
while (<IN>) {
chomp $_;
$seq_no= $_;
my @this_seq=();
if($seq_no=~ m/^complement\(/){
push(@this_seq,1);
$seq_no=~ s/complement\(//g;
if($seq_no=~ m/^order/){
push(@this_seq,2);
$seq_no=~ s/order//g;
$seq_no=~ s/\(//g;
$seq_no=~ s/\)//g;
#my @temp = split(/,/, $seq_no);
push @this_seq,$seq_no;
print "@this_seq \n";
}
}
else
{
$seq_no=~ s/\(//g;
$seq_no=~ s/\)//g;
push @this_seq,$seq_no;
#print "@this_seq \n";
}
push @sequence,\@this_seq;
}
print @sequence;
的出文件
complement(order(1843..1881,1923..2001,2065..2147, 2216..2277,2330..2468))
773..1447
但是當我打印@sequence它只是得到
ARRAY(0x119adb8)ARRAY(0x117e6b0)
我有已經添加\ @this_seq時推入數組,但它仍然顯示內存地址,任何人都可以告訴我如何將其更改爲顯示數組內容。
使用'while(my $ seq_no =){chomp $ seq_no; ......因爲你不用'$ _'。 –