代码如下
open(LINE,"d:/top.txt");
while (<LINE>){if(m/(Total copper :)(.*)(sq\/mm)/){$top = $2};}
close LINE;
$T = sprintf("%.2f",$top / 10000)
top.txt内容如下
Total copper : 25053.227 sq/mm
为什么最后输出的是00.0
while (<LINE>){if(m/(Total copper :)(.*)(sq\/mm)/){$top = $2};}
这句不是已经捕获了25053.227了吗?
浮云间