Why on earth would you want to store HTML pages in a CSV file? You don't plan on serving them up from this one CSV file, do you?

Well, I'd advise you to not use CSV and instead use DBI with a real relational database backend like MySQL or PostgreSQL... But I'm guessing you can't, because if you could, you'd already be doing that instead, right? :)

Ok, well, to mess around with CSV you'd want to use either Text::CSV (with an optional C backend) or DBI with DBD::CSV. Either one of them can handle any needed comma escaping for you. If you only have a handful of these pages, storing them separately on disk really is not a bad idea. If you have a lot of these pages, another better, faster, easier solution than CSV is storing the stuff in some big hash where each key is--I don't know--a page name or section name, and then each value is the corresponding HTML code. Then you serialize it, storing the hash itself to disk that way it can be quickly loaded in the future, using DB_File (my favorite) or some other DBM module (like MLDBM).


In reply to Re: Parsing user input into CSV table by William G. Davis
in thread Parsing user input into CSV table by lwicks

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.