Hi All,
am trying to call the function, which needs to write the arguements passed to this function in a file.
basically creating a log file : thought instead of printing message, i will write the data in seperate log file so that it will useful for later anlaysis.
script goes like this:
when i try to run this script i get this error message :
but when i comment one of the calling function then, logfile gets created but there is not content in it.
All i need is while call this function
in the output logfile i should get the string which is passed to this function.
somethig like this :
can anyone tell me how to acheive this ???
Regards,
Vijayarl
am trying to call the function, which needs to write the arguements passed to this function in a file.
basically creating a log file : thought instead of printing message, i will write the data in seperate log file so that it will useful for later anlaysis.
script goes like this:
Code:
my $string;
my $str="";
my $datestamp = sprintf "%02d%02d%02d",
((localtime)[5]%100, (localtime)[4]+1, (localtime)[3]);
#print $datestamp;
my $time =localtime();
my $subtime = substr($time,11,18);
my $time_sub = substr($subtime,0,8);
#my $datetime=$datestamp."_".$time_sub;
my $logfile ="c:\\Performance_svap\\logfile_$datestamp.txt";
open (Wlog,"> $logfile") or die "Can't open $logfile : $!";
&writelogfile("hi All");
&wirtelogfile("Testing Log file creation");
sub writelogfile($str){
open(Wlog,">> $logfile") or die "Can't open $logfile : $!";
#write $str;
close Wlog;
}
close Wlog;
Code:
C:\Performance_svap\misc>chkempty.pl Undefined subroutine &main::wirtelogfile called at :\Performance_svap\misc\chke mpty.pl line 197.
All i need is while call this function
Code:
&writelogfile("hi All");
somethig like this :
Code:
in logfile: "hi All" should be written
Regards,
Vijayarl
Comment