Hello saint_geser, and welcome to the Monastery!

In addition to the modulus problem highlighted by Anonymous Monk, above (and ignoring the fact that the code snippet you gave doesn’t compile!), there is a problem with the following line:

open (TEMP, '>', $temp) or die Lava::Message("Can't open temporary fil +e");

This occurs within the outer while loop, so on each iteration, whenever the if condition succeeds, the temp file is truncated (“clobbered,” erased) as it is re-opened for output. See open.

Move the open statement to before the loop, so it is executed only once.

Hope that helps,

Athanasius <°(((><contra mundum


In reply to Re: Parsing CSV only returns the second line of the file by Athanasius
in thread Parsing CSV only returns the second line of the file by saint_geser

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.