$#temp

$#temp

一段小代码,帮忙看看,例如读取一行:       D000006        C23.888.646.100.200        C23.888.821.030.249
不太明白foreach语句中的$#temp是什么意思? 在这里是2,为什么不是3   

             while ($line = <TREEIN>){
                                        chomp $line;
                                @temp = split(/\s/, $line);
                                foreach my $node (1 .. $#temp) {
                                        $temp{D000006} .= "\t$temp[$node]" if ($temp[$node] =~/(A|C)/);
                                }
                                undef @temp;
                                undef $id;
                        }
                       
        }#while
数组的下标.
Sometimes you need to find out the last element index in an array. For the array of rocks that we've been using, the last element index is $#rocks.
  • That's not the same as the number of elements because there's an element number zero.

    • Blame this ugly syntax on the C shell. Fortunately, you don't have to look at this often in the real world.


      建议 lz 去读读 learning perl 然后再看代码
  • lz的信誉积分为啥为-5?
    lz的信誉积分为啥为-5? [/quote]