So apparently when you open a file read/write, then read from it you need to seek back to the beginning and preferably truncate it. This is well documented on countless guides but it's never mentioned what happens if you don't seek back to the start. Would writing to a file without the seek just append the write to the file and if so what is the point of a read/write/append mode? And in a similar vein what would be the point of opening a file in read/write/truncate (w+) mode possibly be? I'm writing a collection of functions with plain English names that abstracts away the use of filehandles so I never have to think about file i/o again but can't for the life of me think of a scenario where either a+ or w+ would be useful.

In reply to What is the point of a+ and w+ when opening files? by Maelstrom

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.