Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by extremely (Priest)
on Mar 16, 2001 at 02:13 UTC ( [id://64813]=note: print w/replies, xml ) Need Help??


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

One way you do this is pick two special characters. Pick ones that aren't likely to be used often like "\030" and "\031". Now do this:
my %codes = ("\031" => "\030\001", "\031" => "\030\001"); foreach $item (@items) { $item =~s/(\031|\030)/$codes{$1)/ge; print FILE $item."\031"; }

Now the only "\030"s that appear in the file are the record seperators and you do a simple match like that one to restore the occasional encoded values.

--
$you = new YOU;
honk() if $you->love(perl)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (2)
As of 2024-04-26 07:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found