in reply to Dereferencing a hashref from XML::Simple

Maybe this could help:
#!/usr/bin/perl use warnings; use strict; ; use XML::Simple qw(:strict); use Data::Dumper; my $xml =q(<?xml version="1.0"?> <response> <files> <file file_url="http://server.domain/file1.exe"> file1.exe </file> <file file_url="http://server.domain/"> </file> </files> </response> ); my $ref = XMLin($xml, forcearray => [ qw(files) ], keyattr => [] ); my %files; for my $elem(@{$ref->{files}}){ my $filesref = $elem->{file}; $files{$_->{content}} = $_->{file_url} for(@$filesref); } print Dumper(\%files);

Replies are listed 'Best First'.
Re^2: Dereferencing a hashref from XML::Simple
by helgi (Hermit) on Jul 28, 2006 at 10:59 UTC
    Thanks reneeb,

    but when I try to run that, I get:

    not well-formed (invalid token) at line 2, column 49, byte 93 at c:/Pe +rl/site/lib/XML/ line 185
    Any ideas?

    Helgi Briem
    hbriem AT f-prot DOT com