satzbu has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re: storing xml file in hash
by Corion (Patriarch) on Mar 25, 2010 at 14:12 UTC

    You don't give us much to work with. The easiest way is the following:

    my $filename = 'test.xml'; open my $fh, '<', $filename or die "Couldn't read '$filename': $!"; my $xml_as_hash = { xml => do { local $/; <$fh> }};

    But maybe you wanted something like XML::Simple. In general, you cannot convert an XML file to a hash, because a hash can only have one value per key.

Re: storing xml file in hash
by kennethk (Abbot) on Mar 25, 2010 at 14:12 UTC
Re: storing xml file in hash
by toolic (Bishop) on Mar 25, 2010 at 14:13 UTC
    Use a parser, such as XML::Twig. If you want a more detailed answer, provide a small sample of your XML, your expected output, and the code you have tried.
Re: storing xml file in hash
by Jenda (Abbot) on Mar 25, 2010 at 15:07 UTC