Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Reading in through a port and into a hash?

by IraTarball (Monk)
on Oct 16, 2001 at 22:04 UTC ( #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,

"rm -rf /"

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2019-07-18 22:12 GMT
Find Nodes?
    Voting Booth?

    No recent polls found