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:
-
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;
-
when i try to run this script i get this error message :
-
C:\Performance_svap\misc>chkempty.pl
-
Undefined subroutine &main::wirtelogfile called at :\Performance_svap\misc\chke
-
mpty.pl line 197.
-
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 :
-
in logfile: "hi All" should be written
-
can anyone tell me how to acheive this ???
Regards,
Vijayarl