Closed Thread Icon

Preserved Topic: ActiveState Perl Pages that link to <a href="https://ozoneasylum.com/backlink?for=18134" title="Pages that link to Preserved Topic: ActiveState Perl" rel="nofollow" >Preserved Topic: ActiveState Perl\

 
Author Thread
Boudga
Maniac (V) Mad Scientist

From: Jacks raging bile duct....
Insane since: Mar 2000

posted posted 04-23-2001 18:18

I have an html form with two form fields. I want to write the results to a .txt file (using an ActiveState Perl script) in a way that doesn't overwrite existing data but rather appends to existing data. Can anyone point me to a tutorial on doing so?

Mr. Pecker
Nervous Wreck (II) Inmate

From: Goslow
Insane since: Apr 2001

posted posted 04-24-2001 09:36

To open a file so that you can append new data to the end, put a less than symbol (' > ') infront of the file name to be opened

open (FILE, ">$file") or die "Cannot open $file: $!\n"; # Opens $file for appending new data at the end

After that, everything else is the same for using filehandles

--

hyperbole
Paranoid (IV) Inmate

From: Madison, Indiana, USA
Insane since: Aug 2000

posted posted 04-24-2001 21:07

Actually, if you use "> $filename" you will overwrite the existing file.

To append to the file use open(FILE, ">> $filename");. Then write to FILE using print FILE "String\n";

Boudga
Maniac (V) Mad Scientist

From: Jacks raging bile duct....
Insane since: Mar 2000

posted posted 04-24-2001 21:28

if I have a select field and a text field in an html form, on submit what would I use in the PL script to write to the text file...

I tried one method and it printed the field names not the selected data or the data entered into the text field

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 04-24-2001 21:38

Boudga, it would be good if you could show us your perl script so that we can analyze it...

Mr. Pecker
Nervous Wreck (II) Inmate

From: Goslow
Insane since: Apr 2001

posted posted 04-25-2001 07:13

Ha! Hahahaha good that you pointed that out hyperbola, I should stop waiting till ass at night to check the asylum for anything interesting. Okay, I promise I'll start taking my pills.

Anyways, Boudga what did you try that ended up giving you field names? I would think that just using field names like they were variables (i.e. textfield 'comment' would be reffered to as $comment) but thats totally a guess.

--

« BackwardsOnwards »

Show Forum Drop Down Menu