I'd like to help, but that doesn't even compile. Is that the problem you're asking about, or do you have some code that does compile, but that doesn't do what you want it to do?

From what I can decipher from the code posted, I really think you're working too hard at this. If the file is not "huge", just use Tie::File so you don't have to keep worrying about seeking through the file manually. And if the file is huge, use DBI with DBD:SQLite

Tie::File is part of the core Perl distribution, so you should have it available, and while its performance isn't excellent, it is well debugged, and saves you from having to implement your own flat-file-database solution.


Dave


In reply to Re: replace a value in an array by davido
in thread replace a value in an array by firsttime

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.