in reply to changing data in a file
Therefore, you probably need to 'escape' \r and \n and then unescape them when you read them back. A common trick, if you are using HTML to display your data, is using something like s/[\r\n]/<br>/g - this will replace all CR/LF with <br> tags. If you want them displayed back as carriage returns, then your 'read' script simply reverses the transformation.
Another common way is to replace with the *string* "\n" (s/\n\/\\n/g;) which again you transform back (s/\\n/\n/g;) when you read it in.
Cheers,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: changing data in a file (pitfalls of proper quoting)
by Aristotle (Chancellor) on Apr 21, 2003 at 03:20 UTC | |
|
Re: Re: changing data in a file
by simonthom (Initiate) on Apr 20, 2003 at 19:04 UTC | |
by benn (Vicar) on Apr 20, 2003 at 20:27 UTC |