Beefy Boxes and Bandwidth Generously Provided by pair Networks
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??


in reply to Reading in through a port and into a hash?

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://119205]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-25 05:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found