我收到一个关于解析向量有这样的字符串的问题:
"chr1-247751935-G-.:M92R,chr1-247752366-G-.:R236G,"
"chr1-247951785-G-.:G98K,"
"chr13-86597895-S-78:M34*,chr13-56891235-S-8:G87K,chr13-235689125-S-7:M389L,"
我想得到:
"M92R R236G"
"G98K"
"M34* G87K M389L"
当我使用
while ($info1=~s/^(.*)\:(([A-Z\*]){1}([\d]+)([A-Z\*]){1})\,//)
{
$pos=$2;
}
结果 $pos 只给我每一行的最后一个,即:
"R236G"
"G98K"
"M389L"
我应该如何更正脚本?