Hi Guys,

I am calling 2 programs from my perl script. Output of
these program is being displayed in STDOUT.
I want to display this outout in STDOUT as well as
want to log output of each program in separate files.
How to do this?

In order to do above, I tried following program:
#!/usr/bin/perl -w
use strict;

print "Started the file write\n";
for (my $cnt=0; $cnt < 4; $cnt++)
{
my $sFile = "foo_" . $cnt . ".txt";
open STDOUT, "| tee $sFile" ;
print $sFile, " ", $cnt, "\n";
#close(STDOUT);
}

1. Problem in above program is that foo_0.txt have all
the output in this (as given below)
foo_0.txt 0
foo_1.txt 1
foo_2.txt 2
foo_3.txt 3

2. Other problem is that I am able to close the STDOUT
or not able to dis-link file $sFile.

Waiting for your response

/Bye
Ambikesh



                
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Find what you need with new enhanced search. 
http://info.mail.yahoo.com/mail_250

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to