I'll admit up front to being a little confused, but I'll take a crack at his any way.

First, you talk of reading from a port, do you mean a socket? If so, and if you need help here, start with IO::Socket You should be able to read from a socket like a regular file handle.

Next, parsing your data. You will likely want to read in each line, parse it with split or some regex goop. I'm glazing over this because I want to get to the...

Next part, writing it to XML. Check out XML::Simple. It's cool. Once you have the data in a hash you can just say XMLout(\%hash, "file.xml"); and you have your xml file. You probably want to set some options so read the docs.

This is probably not as detailed as you might have hoped, especially the 'goop' part, but read some docs, post some code, and I think you'll find you get usable code posted back.

Good Luck,
Ira,

"rm -rf /"
~guest


In reply to Re: Reading in through a port and into a hash? by IraTarball
in thread 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.