Travis-

How big are these files?

Does the first file only contain one record, or multiple records?
If it has only one record I would try doing this as follows:

Open and read the first file.
Loop though the second file reading one line at a time.
Read the line, compare to the record you want to change to the record you just read, then write to a temp file the correct entry.
Once you have gone though the entire second file. You will have two files, the original second file and a temp file that is identical to the second file but with the record change. If your record change was successful then rename the old second file to something like data.old and rename the temp file to the name of the second file. ( this give you a roll back ability if something goes wrong) You can have multiple data.old files to act as an undo feature.

If you have multiple lines you have to replace, I would consider using a module on CPAN that would give you a generic interface to your data.
Good luck
ZeroFlop

P.S. You may just be off a little in your code. Posting the reivant part will help in supporting you!

In reply to Re: flat file databases by Zero_Flop
in thread flat file databases by Travis M.

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.