Let me ask the question a bit clearly. Consideration 1(no use of external module):

How can i have readCSV subroutine read and populate multiple array lists if there is more than one rows? I am fairly new to perl and yet to get over common mistakes.

The readCSV sub does read the csv files on the fly and creates each XML at its directory. This goes fine with XMLs where there is only one row. In readCSV i could read the rows to array list and extract the elements of the array against its column heading (as key) and extract that value to variable to be used to create the XML with generateXML sub.So i don't need to care about computing rows and populating no more than one array list

Now when there is multiple rows at the CSV the situation changes . Now readCSV not only have to sort keys so as to get the values from the first array list it reads it would need to count rows there, if more than one then read one row at a time each one to separate array list, it should do that dynamically so parseCSV can parse each array list do the regex substitution etc (whatever operation may require). This would do the cleanup/ manipulations apply rules and pass it to generateXML all in one go.

Consideration 2(use of external module):

As a personal preference i should probably use a module the do the job, making the life a lot easier but saying that is easy, than doing because i have inherited bunch of other scripts and i really don't want to see them break if i change the code entirely. I would start creating the whole thing ground up fresh but for now i thought to fix this would be of less time than to start afresh with readCSV_PP start afresh with readCSV_PP or any other module in this regard.


In reply to Re^4: Multiline CSV and XML by sanju7
in thread Multiline CSV and XML by sanju7

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.