XML::Parser Tree Style

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Hi guys and gals

So I am a little new to XML::Parser but I have read the docs and PODs
and know that this module has what I need but I am a little stuck on
I have this XML:
<?xml version='1.0' encoding='UTF-8'?>
<list name="Nialls list">

and I have this perl script:


use XML::Parser;
use Data::Dumper;
use strict;
use warnings;

$parser = new XML::Parser( Style => 'Tree' );
my $tree = $parser->parsefile( 'testxml.xml' );

print Dumper( $tree );

which prints the contents of the xml to the screen. However what I
really want to do is Parse through the file taking out each firstname
and putting them in an array. At the very least I would quite like to
just know how to 'get at' to a node.

The $tree - is it an array? a scalar? a variable? little confused
there you see. If it is a scalar, how do I get access to it?

Thanks in advance

Site Timeline