我还在学习perl
并且所有人都写了一个程序。我的问题,尽可能简单,如果我想将字符串硬编码到字段,下面会这样做吗?谢谢你:)。
$out[45]="VUS";
在其他行中,我使用下面的内容来定义传递给`$ [out]的值,但是有问题的值是硬编码的,其他的来自分割。
my @vals = split/\t/; # this splits the line at tabs
my @mutations=split/,/,$vals[9]; # splits on comma to create an array of mutations
my ($gene,$transcript,$exon,$coding,$aa);
for (@mutations)
{
($gene,$transcript,$exon,$coding,$aa) = split/\:/; # this takes col AB and splits it at colons
grep {$transcript eq $_} keys %nms or next;
}
my @out=($.,@colsleft,$_,@colsright);
$out[2]=$gene;
$out[3]=$nms{$transcript};
$out[4]=$transcript;
$out[15]=$coding;
$out[17]=$aa;
答案 0 :(得分:2)
您的代码行:$out[45]="VUS";
是正确的,因为它将数组@out的第46个元素定义为字符串“VUS”。我试图从你的代码中理解,但是你为什么要这样做呢?通常,最好不要硬编码,如果可能的话。您希望将您的计划尽可能地变为现实。