in reply to Re: XML::Simple - Make arrays out of class attribute
in thread XML::Simple - Make arrays out of class attribute

OOPS

After posting this i realized it clobbers the duplicates, which I didnt see at first.

This is possible with the KeyAttr option:

#!/usr/bin/perl use Data::Dumper; use XML::Simple; use strict; use warnings; my $filename = shift or die "Usage: decode <filename>\n"; # dies on its own on error my $xmldata = XMLin($filename, KeyAttr => { 'div' => 'class' }); print Dumper $xmldata; __END__

Replies are listed 'Best First'.
Re^3: XML::Simple - Make arrays out of class attribute
by ikegami (Patriarch) on Sep 14, 2008 at 22:13 UTC
    Your code doesn't work. It deletes 4 of the 6 elements.