kuldeek has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem logging STDOUT in perl
by aitap (Curate) on Aug 22, 2012 at 07:21 UTC | |
|
Re: Problem logging STDOUT in perl
by Athanasius (Archbishop) on Aug 22, 2012 at 07:39 UTC | |
by kuldeek (Initiate) on Aug 22, 2012 at 08:34 UTC | |
by Athanasius (Archbishop) on Aug 22, 2012 at 12:54 UTC |