You are right, but it could be different if the module ties the file to the array starting at its second index.

The module's documentation gives mixed information. My suggestion was based on the following quote from module synopsis:

$array[13] = 'blah'; # line 13 of the file is now 'blah'

Same assumption is repeated through the pod file (line 17 under index 17 and so on). But in another place, the same documentation states:

The first line of the file is element 0 of the array; the second line +is element 1, and so on.

I think it's best that the OP tries the module, and does not assume anything, prior to some tests.


UPDATE:

jwkrahn is right. Out of curiosity, I did the tests - all works like a normal array should - $array[2] points to the third line of the file. Seems that the module documentation could use some corrections.

regards,
Luke Jefferson


In reply to Re^3: write to/append a specific line in output file by blindluke
in thread write to/append a specific line in output file by aquinom

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.