Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
      Hi, I am trying to create hash table using perl script.

It is wonderful that you have posted your XML input data as a sample. You haven't posted any Perl code and quite honestly if you are trying to get the monks here to do your work for you I'm not sure that's going to happen.

If you want broad stroke advice on how to approach the problem, let me take a whack at it for you:

  • First analyze the data you are working with and identify how you want the data organized (data structure) and what data is important and what isn't. Figure out a "key" to identify individual records of data or failing that maybe you want to use an array instead and use numeric indices to select records?
  • Figure out a strategy for parsing the XML to extract the data you want. My personal favorite is to use the CPAN module XML::Simple. OBTW: depending on the arguments it supplies it may organize your data into data structures of its own choosing. So you may want to examine what it has done using Data::Dumper.
  • Probably should have put this as the first bullet item, but make sure your XML is well formed. If it is not, most XML parsers will barf on you which is not pleasant. Getting data chunks in your lap isn't fun.


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

In reply to Re: Hash Table genaration using perl by blue_cowdawg
in thread Hash Table genaration using perl by veerubiji

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others drinking their drinks and smoking their pipes about the Monastery: (12)
    As of 2014-07-23 08:42 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (137 votes), past polls