Closed Thread Icon

Preserved Topic: writting to a file in PERL Pages that link to <a href="https://ozoneasylum.com/backlink?for=17808" title="Pages that link to Preserved Topic: writting to a file in PERL" rel="nofollow" >Preserved Topic: writting to a file in PERL\

 
Author Thread
foam
Bipolar (III) Inmate

From: Fontana, Ca, USA
Insane since: Jun 2000

posted posted 06-22-2000 06:27

Hey guys, i need to know how to write to a file, but overwrite EVERYTHING inside of the file, understand?

please help!!

thanks alot!

foam
www.thefoam.org

drcyc
Nervous Wreck (II) Inmate

From: tempe, az, usa
Insane since: Jul 2000

posted posted 07-11-2000 13:50

Okay, I'll do my best to help using examples.

code:
#!/usr/bin/perl
# write new file (overwrite if exists)
open(FILE,">filename") or die("unable to open file");
print FILE "this will be written to file";
close(FILE);
exit;



Notice the ">" before the filename. This will open the file in overwrite mode. If you want to open the file in append mode, change the ">" to ">>".

If this doesn't answer your questions, feel free to e-mail me.




drcyclops

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 07-11-2000 15:11

To read the file leave it blank or use <


www.warmage.org

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 07-11-2000 20:37

Foam I am totally sorry I flaked on you. I was helping you out with your script. I got side-tracked with all this gurusnetwork stuff and you got put on the back burner but the answer to this drcyc has it right


Walking the Earth like Kane

« BackwardsOnwards »

Show Forum Drop Down Menu