Not to put words in his mouth, but the point I think japhy
(right?) was trying to make was that, if the reason you're
writing to the beginning of the file is that you think that
there's where you should store the most "recent"
information, then there's really no point.
Just keep your
file in chronological order (oldest at beginning, newest
at end) and, when you're reading the file into memory,
use unshift rather than push so that the newest data
ends up at the beginning of the array.
Which definitely makes sense, and makes the problem quite
a lot less complicated, if that's the reason the op
wanted to write to the beginning of the file.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|