|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
文件sn内容为:
Warning:jlfjalkjfldajflk(UID-346)
Warning:jlfjalkjfldajflk(UID-376)
Warning:jlfjalkjfldajflk(UID-348)
Warning:jlfjalkjfldajflk(UID-346)
Warning:jlfjalkjfldajflk(UID-376)
Warning:jlfjalkjfldajflk(UID-348)
想每个UID类型写到一个sheet里,然后在读去每行是判断什么类型的,写到相应的sheet里,每判断一行,相应的sheet里多一行这个warning;
在实现时,遇到问题:Can't call method "write" without a package or object reference at excel.pl line 91, <IN> line 4.
主体程序段如下:各位帮忙看下,谢谢;-)
open IN,"sn"||die "can not open the file !\n";
while (<IN>) {
if ($_ =~ /(Warning:.*\((\S+)\))/) {
$type = $2;
$content = $1;
$hash->{$type}->{$type} = $type;
$hash->{$type}->{$content} = $content;
for ($m =0,$m <=$#type,$m++) {
if($type[$j] eq $hash->{$type}->{$type}) {
$new_flag = 1;
last;
}
else {
$new_flag = 0;
print "bbbbbbbbbb\n";
}
}
if (!($new_flag)) {
$type[$k] = $hash->{$type}->{$type} ;
$hash->{$type}->{$type}->{number} =1;
$worksheetno = '$worksheet'.$k;
${worksheetno} = $workbook->add_worksheet("$type[$k]");
$worksheetno->write("B2", "$hash->{$type}->{$content}");
$worksheetno->write("C2", "$hash->{$type}->{$type}->{number}");
$count++;
$k++;
}
else {
$hash->{$type}->{$type}->{number} ++;
$worksheetno = '$worksheet'.$m;
$rowno = $hash->{$type}->{$type}->{number};
$worksheetno->write("B2", "aa");
}
}
} |
|