Ok, I have a file that holds the html code for any users of my site.
Right now though, I have it set so that when the user modifies their page in a textarea box, when they save it, I strip all the carriage returns.
I do this because when I attempt to load their page from the file, It stops reading that user's page when it hits a carriage return.
I split each user's page with '&..&' and their username and page content with ':..:'
So the file looks like this:
User1:..:
Hello
&..&User2:..:
Welcome
This works fine, except that when you go to edit your page again, All the code is bunched up on a couple lines...
What I'd like to do is to not have to strip all carriage returns, and then read from the file.
So, basically, here's my question:
How can I read an entire file into a hash (username and content), and not have the hash contain only the content of a user's page up until a carriage return?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.