Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: map <IF> to hash with replacement

by crashtest (Curate)
on Feb 05, 2010 at 01:49 UTC ( [id://821487]=note: print w/replies, xml ) Need Help??


in reply to map <IF> to hash with replacement

Your immediate problem seems to be solved, but based on your question, I am guessing you are doing some sort of XML processing. If you are, I'd suggest you skip re-inventing any wheels and consider the resources already available.

The main XML parsing module on CPAN is XML::Parser. A handier interface to it is provided by XML::Simple.

PerlMonks has a tutorial on XML::Parser, although it's almost ten years old.

Edit: As I wrote this, in the back of my mind I was hoping that another monk would help out in case my recommendations were out of date. Your Mother came through - thanks!

Replies are listed 'Best First'.
Re^2: map <IF> to hash with replacement
by Your Mother (Archbishop) on Feb 05, 2010 at 02:22 UTC

    I understand this is well intentioned but I think it's bad advice. XML::Twig, XML::Rules, and XML::LibXML are probably all to be preferred over XML::Parser; I'd argue the libxml wrapper is definitely a better choice. And XML::Simple is anything but; it's a maze of special cases and their mapping parameters. It can be a very useful module but I wouldn't recommend it without knowing the problem and input at hand.

      I would use XML::Simple. It's dead easy to bring XML in as Perl structures.
      use XML::Simple qw{XMLin}; print keys %{XMLin("<root><x>1</x><y>2</y></root>")};
      This prints "xy".

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-04-18 09:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found