in reply to Parsing XML

$xml->isa('HASH') will not work if $xml is not blessed, so if it is a hash ref or an array ref you won't be able to use this syntax. You have to use UNIVERSAL::isa(  $xml, 'HASH') instead, calling isa as a regular sub.

Update: you might also be better off using a higher-level module like XML::Simple, which will put the data into a nice Perl data structure for you.

Replies are listed 'Best First'.
Re: Re: Parsing XML
by grantm (Parson) on Nov 26, 2002 at 19:57 UTC

    Or XML::Twig :-)

    I wouldn't recommend investing too much time coding to XML::Parser's API. The two standard APIs used by a number of modules are DOM for tree based parsing and SAX for stream based parsing. Use these and you won't be tied to one parser.

    Alternatively if you want to write less code, use one of the higher-level Perl-specific APIs like XML::Simple or XML::Twig.