in reply to Need an hash of the Parsed Document !

Not sure if this is what you want

#!perl use strict; use XML::Twig; my $twig = XML::Twig->new (); my $hr = $twig->parse(\*DATA)->simplify; for (@{$hr->{'Account'}}){ print $_->{'Id'}."\n"; print $_->{'OwnerLastName'}."\n"; print $_->{'OwnerFirstName'}."\n\n"; } __DATA__ <?xml version="1.0" encoding="utf-8"?> . . .
poj

Replies are listed 'Best First'.
Re^2: Need an hash of the Parsed Document !
by Anonymous Monk on Dec 17, 2015 at 17:10 UTC

    Thank You for your attempt to help 'poj'. But, I don't want to print them. Instead I want to store and return them as a hash - which needs to be used by another function (sub) for doing the validation.

      Your hash is %$hr - see simplify method in XML::Twig

      Simplify - Return a data structure suspiciously similar to XML::Simple's. Options are identical to XMLin options, see XML::Simple doc for more details (or use DATA::dumper or YAML to dump the data structure)

      poj