<a href="mailto:china-pm@pm.org">
<p>我现在有个文件类似<br>struct C {<br>a=..;<br>b=..;<br>c=..;<br>d=..;<br>}</p>
<div>struct C {<br>a=..;</div>
<div>b=..;</div>
<div>c=..;</div>
<div>d=..<br>}<br>...<br>我要读出每个结构的a和c值<br>我用了<br>my $condition=0;<br>while(&lt;FILE&gt;) {<br>&nbsp;if (/a=(.+)/) {<br>&nbsp;&nbsp;$arr[0] = $1;<br>&nbsp;&nbsp;condition = 1;<br>&nbsp;} elsif(condition == 1 &amp;&amp; /c=(.+)/) {<br>&nbsp;&nbsp;$arr[1] = $1<br>
&nbsp;&nbsp;condition = 0;<br>&nbsp;&nbsp;# 往数据库插入@arr<br>&nbsp;}<br>}<br>这样只能得到第一个struct的数据,然后提示<br>Use of uninitialized value in pattern match (m//) at ... <br>&nbsp;</div></a>