作者yalent ( 心只有你 )
看板Perl
标题[问题] 取值
时间Sat Apr 12 16:15:45 2014
大家好,小弟有一个档案内容为
ID2*1,2,4*2,3,4*
ID3**2*
ID4***
想将内容转为
ID2 1
ID2 2
ID2 2
ID2 3
ID2 4
ID2 4
ID3 2
ID4
小弟目前只有办法取值(如下),但是要排成我想要的样子..毫无头绪..
if ($_ =~ /(.*)\*(.*)\*(.*)\*/ )
{
print "$1 $2 $3\n"
}
不晓得关於这个部份要怎麽处理呢?
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 220.130.131.58
※ 文章网址: http://webptt.com/cn.aspx?n=bbs/Perl/M.1397290548.A.496.html
1F:推 uper:问一下喔 一行里面都会有三个*吗? 04/12 19:58
2F:→ yalent:是的,每一行都会有三个* 04/12 22:41