Hello wise perl monks... I am asking this question in complete humility. Please help if you can, but do not be to critical on me, as I am trying my best to complete the given task before me. Okay, here is something similar to the data file that will be getting passed into a port for the retrieval of perl...
"DESTINATION" "localhost" "x2pd" "HDR" "HDR-1" "" "HDR-3" "" "" "" "HDR-7" "09/06/2001" 99999 "" "hdr-11" "hd +r-12" "" "" "B" "INI" "INI-1" "" "INI-3" "INI-4" "INI-5" 0 0 "88888888" 9999.99 "PER" "A1" yes "per-3" "" "per-5,per-5,per-5,per-5,per-7,per-5,per-5" "" "77 +7777777" 01/01/71 99 "10101010" 0 0 "13" ""
This is only a small piece of the file, but if you can help me to know how to read this in through a port and then store it somehow (my guess is hash references), then take each field and create an XML tree, that would be awesome. Again, I ask of you not to be overly critical of me as I am only an egg and and am humbly asking for your help with this one. Another side note, notice under the PER packet that there is a comma delimitted field being passed in that would need to be read into one area and then split out for the creation of this tree... Here is how the tree would look...
<?xml version="1.0"?> <application id =”_10”> <account_application> <destination>localhost</destination> <application_type>x2pd</application_type> </account_application> <header> <header-1>HDR-1</header-1> <header-2></header-2> <header-3>HDR-3</header-3> <header-4></header-4> <header-5></header-5> <header-6></header-6> <header-7>HDR-7</header-7> <header-8>09/06/2001</header-8> <header-9>99999</header-9> <header-10></header-10> <header-11>hdr-11</header-11> <header-12>hdr-12</header-12> <header-13>B</header-13> </header> <ini> <ini-1>INI-1</ini-1> <ini-2></ini-2> <ini-3>INI-3</ini-3> <ini-4>INI-4<ini-4> <ini-5>INI-5</ini-5> <ini-6>0</ini-6> <ini-7>0</ini-7> <ini-8>88888888</ini-8> <ini-9>9999.99</ini-9> </ini> <personal> <personal-1>A1</personal-1> <personal-2>yes</personal-2> <personal-3>per-3</personal-3> <personal-4></personal-4> <personal-6></personal-6> <personal-7>777777777</personal-7> <personal-8>01/01/1971</personal-8> <personal-9>99</personal-9> <personal-10>10101010</personal-10> <personal-11>0</personal-11> <personal-12>0</personal-12> <personal-13>13</personal-13> <personal-14></personal-14> </personal> <comment> <personal-5>per-5</personal-5> </comment> <comment> <personal-5>per-5</personal-5> </comment> <comment> <personal-5>per-5</personal-5> </comment> <comment> <personal-5>per-5</personal-5> </comment> <comment> <personal-5>per-7</personal-5> </comment> <comment> <personal-5>per-5</personal-5> </comment> <comment> <personal-5>per-5</personal-5> </comment>
Sincerely and humbly, dez L Please notice that the incoming data stream is seperated by "s in some spots and spaces in others, this is leaving me with great frustration, as you can only imagine.

In reply to Reading in through a port and into a hash? by basicdez

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.