Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-19 22:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found