Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 results in 2 files print to 1

Status
Not open for further replies.

Porshe

Programmer
Jun 5, 2001
38
0
0
US
Hi. I have file.pl that generates data to a result file- data.pl. In the middle of the process, it stops and system opens another file for output. How can I get all the output from 2 different scripts to write to 1 output file (data.pl)?
#This is my result file that is opened in file.pl
open OF, ">$report_file_name" or die "Can't Open $report_file_name: $!";

This is a loop in file.pl
foreach ($ip) { system('/export/home/manager/ready/proxy.pl', $ip);
system("perl proxy.pl $ip");
}

It opens proxy.pl for more data to be outputed. I want it to append to
the file that was opened ($report_file_name) in file.pl.

Any ideas? hope this was clear.
Portia




 
You can have proxy.pl open the same output file for *append*, using the append operator >>, like this:

open(OUT, ">>$report_file_name") || die "Can't open $report_file_name: $!";

that will cause any

print OUT "Something";

to *append* to $report_file_name, instead of replacing what's there.

HTH.
Hardy Merrill
Mission Critical Linux, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top