I have a program, which call a subroutine and logs the STDOUT to a different file for each subroutine called.
foreach $test_run (keys(%test_hash)) { if ($test_hash{$test_run} == 1) { $test_execute = $test_run; $test_execute1 = $test_run."."."pm"; my $logfile = $test_execute."_log.txt"; print "the logfile is $logfile \n"; open (STDOUT, "| tee $logfile"); require "$test_execute1"; my $op = $test_execute->$test_execute(); }
On executing my script with above code creates all the log files, but lets say foreach loop runs for 3 times; then first log file have output of all the 3 calls of test_execute,2nd log file have output of 2nd and 3rd calls of test_execute and last log file will have only last call of test_execute. Please help me get all the logg files which contains logs for every single test_execute call.
In reply to Problem logging STDOUT in perl by kuldeek
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |