Yes, the first line of the CSV contains field names, sorry for not mentioning that.

Thank you for the recommendations. I had not tested for the existence of the file or the assertion that the first line is field names because this is a CSV that I made myself to use with this program. It will only be modified when the customer opens new shops. I will follow your recommendations.

What I'm trying to get to with the program is on one hand to have an array with each product, store & quantity, taken from the EDI file, and on the other to have one array listing store numbers of each type.

I then plan to go through the "product,store,quantity" array and make a sum of totals per product for each store type (i.e. THSB01 for li type stores = 30, THSB01 for ff type stores = 15, etc.). This is because I need a different price label format for each store type.

Would it help if I posted dummy store.csv and po.edi files?

If I put the code for the CSV file by itself and run it, it does what I want it to do (i.e. list of store numbers in two arrays). The problem only happens when I try to integrate that subroutine into the rest of the program.

Thanks!

In reply to Re^2: Cannot work on second file after reading first file. by 1straw
in thread Cannot work on second file after reading first file. by 1straw

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.