CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Problem logging STDOUT in perl: Edit Log



kuldeek
Novice

Aug 21, 2012, 9:39 PM


Views: 2299
Problem logging STDOUT in perl

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.


(This post was edited by kuldeek on Aug 21, 2012, 9:40 PM)


Edit Log:
Post edited by kuldeek (Novice) on Aug 21, 2012, 9:40 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives