http://qs1969.pair.com?node_id=64518


in reply to Storing multi-line form data in a flat file?

Unfortunately, there's always going to be a small cavaet to doing this, but if you can assume that a certain symbol or group of symbols will not be used by those entering the form, you can substitute that symbol(s) in for the carriage return. For example:
my $replacement = "##"; $multiline_data =~ s/\n\r?/$replacement/g; print <OUTFILE> $multiline_data; ... my $read_data = <INFILE>; $read_data =~ s/$replacement/\n/g;
The problem being that if someone used '##' in their string, that would be replaced by \n on the return loop.

A better option is that you store the multiline data into it's own file separate from the flat file, the filename related to an id or the like. This way, you preserve the \n and don't have a problem with losing someone's text.


Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain