in reply to Extracting tagged data from a XML file

I would recommend to use a module like XML::Simple (http://search.cpan.org/~grantm/XML-Simple-2.12/lib/XML/Simple.pm).

use XML::Simple; my $file = '/path/to/your/xml.file'; my $xml = XMLin($file); my $ip_address = $xml->{'IP-ADDRESS'};

Replies are listed 'Best First'.
Re^2: Extracting tagged data from a XML file
by davorg (Chancellor) on Aug 31, 2004 at 10:31 UTC

    Doesn't that only catch top-level nodes in the file?

    --
    <http://www.dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

      XML::Simple parses the whole file. With Data::Dumper you can display the datastructure!

      You can get the values for all nodes in the xml-file.

        Oh, I know how XML::Simple works. It just seems a lot of work to load the file into a data structure and then manually examine the data structure to find out which parts to are interested in. The XPath solution just grabs all of the correct nodes no matter where they are in the file.

        There are certainly times when XML::Simple is the right tools for the job - but I don't thing this is one of them.

        --
        <http://www.dave.org.uk>

        "The first rule of Perl club is you do not talk about Perl club."
        -- Chip Salzenberg