Hi,

I'm trying to overhaul my perl flat-file database into a speedy mod_perl / MySQL solution... I'm wondering about how to deal with my arrays, though. Currently I'm using:
$timeold = <FILE>; @datas = <FILE>;
After reading the time, this neatly puts the remaining contents of the file into @datas which I can happily pass along to the user. New entries are just appended to the file with a new line character at the end:
print FILE "$new_data\n";
I do periodically remove the oldest lines (near the top) in an effort to keep the file from growing too large. So how could this type of array-like functionality be accomplished in my new design? Possibly with a SET? But this seems to have a maximum of 64 elements and there is no such limit the old way. I also thought of using one huge BLOB to store the data and then splitting it up after retrieval, but that would make for painful maintenance, I suppose. Or maybe I'm just overlooking something basic in database design (I'm new to this!).

Also, is this overhaul worth the effort? Will I see the speed increase I hope for?

Thanks for any suggestions!

In reply to arrays in database by dev2000

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.