How about a little data? Not all the data, just enough to demonstrate the problem. You should also show us a sample of what you get and what you expect for the sample data.

At present I can't tell if there should be data for 40 buildings, but you are only seeing output data for 11, or if the problem is that there are 40 columns in the input and only 11 in the output. Although you describe your output file as CSV, it's not using the same format as the original file and doesn't conform to the usual expectations for a CSV file - it may be better thought of as a text or data file to avoid confusion.

As an aside, don't globally declare local variables - all your temporary variables should be declared where they are initialized (inside the loop or sub). Use the three parameter version of open and use a lexical variable (my $myFile) instead MYFILE (good to see the open is checked though).

Also, use a while loop rather than a for loop for reading input lines.


True laziness is hard work

In reply to Re: Printing of Array Hash is Missing Elements by GrandFather
in thread Printing of Array Hash is Missing Elements by spickles

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.