Excelシートの行を印刷するために、Spreadsheet :: WriteExcelのwrite_row/write_colを取得するのに苦労しています。Spreadsheet :: WriteExcel perlのヘルプ
私は、この作業方法をテキストファイルとして印刷しています。しかし、行/列としてそれらをExcelシートに書き込むことは、私が失敗しているところです。 My $ com_samはこれに似ています。一致するすべてのサンプルとそのパーセンテージをキーとして保持し、各サンプルとの一致の他のすべての詳細を保持するマルチレベルハッシュですか?(X3、X32、E32_P、E32_PLはサンプルです)
WriteExcelを使用してそれらを印刷しようとしたときのコードです。
foreach my $percent (sort { $b $a } keys %{ $com_sam->{ $s1 } }){
249
250 my $match_samples = $com_sam->{ $s1 }->{ $percent };
251
252 foreach my $matSam(@ { $match_samples }){
253 if(($s1 ne $matSam->{ sample }) and ($matSam->{ percent } >= $top_percent)) {
254
255 next if compare($s1, $matSam->{sample});
256 # print "****,$s1,$matSam->{ sample },$matSam->{ percent },$top,$top_percent,$matSam->{ NoofCalls },$matSam->{ match }, $matSam->{ NoofNs },****\n" ;
257 push @$log_array,($s1,$matSam->{ sample },$matSam->{ percent },$top,$top_percent,$matSam->{ NoofCalls },$matSam->{ match }, $matSam->{ NoofNs });
258 push @$array_ref_log, @$log_array;
259 for my $col (0 ..7) {
260
261 for my $row (1 .. scalar(@sam2com)) {
262
263 $worksheet->write_row($row,$col,$array_ref_log);#Wat I get with this is just a single sample compared rather than all the sample.
264 }
265
266
267 }
268 }else{
269
270 my $total_calls = $matSam->{ NoofCalls } + $matSam->{ NoofNs };
271
272 my $l = sprintf "%s, %s, %0.2f, %s, %0.2f,%s,%s,%s", $s1, $matSam->{ sample }, $matSam->{ percent }, $top, $top_percent,$matSam->{ NoofCalls },$matSam->{ match }, $matSam->{ NoofNs } ;
273
274 if($total_calls == 97) {
275
276 # print "$l\n" if ($matSam->{ NoofNs } { NoofNs } sample
287 }#end of percentage foreach loop
私はこの
X3,X3,100.00,X3,100.00,30,30, 0
X3,X32_P,100.00,X3,100.00,30,30, 0
X3,E32,100.00,X3,100.00,30,30, 0
のような結果を見たいのではなく、私はExcelでこのようにそれを得ます。 (:)コンマ区切りではないofcourseの)
X3,X32,100.00,X3,100.00,30,30, 0,X3,X32_P,100.00,X3,100.00,30,30, 0,X3,E32,100.00,X3,100.00,30,30, 0
X3,X32,100.00,X3,100.00,30,30, 0,X3,X32_P,100.00,X3,100.00,30,30, 0,X3,E32,100.00,X3,100.00,30,30, 0
X3,X32,100.00,X3,100.00,30,30, 0,X3,X32_P,100.00,X3,100.00,30,30, 0,X3,E32,100.00,X3,100.00,30,30, 0
X3,X32,100.00,X3,100.00,30,30, 0,X3,X32_P,100.00,X3,100.00,30,30, 0,X3,E32,100.00,X3,100.00,30,30, 0
X3,X32,100.00,X3,100.00,30,30, 0,X3,X32_P,100.00,X3,100.00,30,30, 0,X3,E32,100.00,X3,100.00,30,30, 0
X3,X32,100.00,X3,100.00,30,30, 0,X3,X32_P,100.00,X3,100.00,30,30, 0,X3,E32,100.00,X3,100.00,30,30, 0
X3,X32,100.00,X3,100.00,30,30, 0,X3,X32_P,100.00,X3,100.00,30,30, 0,X3,E32,100.00,X3,100.00,30,30, 0
X3,X32,100.00,X3,100.00,30,30, 0,X3,X32_P,100.00,X3,100.00,30,30, 0,X3,E32,100.00,X3,100.00,30,30, 0
はどのようにwrite_row/write_colためarray_refに取り組んですべきですか? ありがとうございます
'$ array_ref_log'は設定されていないようです。実際に出力するために実行したコードは...? – plusplus
申し訳ありませんが、私はそれをコメントしました。しかし、私はスクリプトを実行してコメントを外された。問題はちょうどこのビットにあります。だからこそ、私はスクリプト全体を投稿するのです。 – kutipi