Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Storing multi-line form data in a flat file?

by Masem (Monsignor)
on Mar 15, 2001 at 02:11 UTC ( #64518=note: print w/replies, xml ) Need Help??


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

Replies are listed 'Best First'.
Re: Re: Storing multi-line form data in a flat file?
by SilverB1rd (Scribe) on Mar 15, 2001 at 02:20 UTC
    Thats why I want to encode the data so I can preserve the coding.

    ------
    The Price of Freedom is Eternal Vigilance

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://64518]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2022-10-04 14:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred way to holiday/vacation is:











    Results (17 votes). Check out past polls.

    Notices?