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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
Flat File Reformatting and File Creation



Jul 15, 2000, 2:01 PM

Post #1 of 2 (756 views)
Flat File Reformatting and File Creation Can't Post

I am printing reformatted data to a temp file. I then would like to open that temp file, alter the data in some lines and then save all the data to another file. I am unable to get data in 2nd file when I save.
Code used is:
open(INPUT, $ifile) or die("Can't open the input file $ifile$!\n");
open(OUTPUT, $outfile) or .....## temp file
print OUTPUT $OVR_Record."\n";
open(INPUT2, $outfile)or die....;
open(OUTPUT1, $outfile1) or die....;
while ($baanfile = <INPUT2> )
I am altering lines in the $outfile.

Then I am doing:
print (OUTPUT1 $baanfile.\n");
I am getting no data in the 2nd file.
What am I doing wrong. It is driving me nuts!



Jul 15, 2000, 6:11 PM

Post #2 of 2 (756 views)
Re: Flat File Reformatting and File Creation [In reply to] Can't Post

You're not opening the temp file for writing.

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

open OUTFILE1, "> $outfile1"
or die "$!";</pre><HR></BLOCKQUOTE>

A solitary > will overwrite any existing data, while >> will append to any existing data.


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

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