0

Hello am trying to parse log file and redirecting the output to some number of files but lastly some junk named file is creating.. GLOB(0x152c4e4).txt, GLOB(0x1545c1c).txt like that In code am defining each variable in global

my $g1logFIle = " " ;
my $V1gFIle = " " ;
my $D1logFIle = " " ;
my $D1logFIle = " " ;

Again am opening a file to redirect its output-

open( $g1logFIle, ">>" , g1logFIle.".txt" ) or die $!;
open( $V1logFIle, ">>" , V1logFIle.".txt" ) or die $!;
open( $D1logFIle, ">>" , D1logFIle.".txt" ) or die $!;

And while parsing am just printing my parsed output in file-

print $D1logFIle "+D1Launch Request ", ($D1hMetrics{NoOfTimes} + 1), "\n\n"
print $V1logFIle  "+VOD Launch Request ", ($V1Metrics{NoOfTimes} + 1), "\n\n";

where am doing wrong??

4

1 回答 1

1

当我运行您的代码时,我会得到类似g1logFIle.txt. 如果您在文件名中使用了变量,则文件将GLOB(0x152c4e4).txt被创建。$g1logFIle您应该为文件句柄(的第一个参数open)和文件名(第三个参数)使用不同的变量。

open my $G_HANDLE, '>>', "$g1logFIle.txt" or die $!;
于 2013-04-17T12:58:04.553 回答