No such thing as a small change | |
PerlMonks |
Re: Reading in through a port and into a hash?by IraTarball (Monk) |
on Oct 16, 2001 at 22:04 UTC ( [id://119205]=note: print w/replies, xml ) | Need Help?? |
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,
"rm -rf /"
In Section
Seekers of Perl Wisdom
|
|