in reply to XML::Simple Not Sorting
I just searched for the word sort in your lengthy code and did not find a match. XML::Simple does not sort the data for you ... you have to sort it yourself:
use XML::Simple; use Data::Dumper; my $xml = XMLin(\*DATA); print Dumper $xml; $xml->{bar} = [ sort @{ $xml->{bar} } ]; print Dumper $xml; __DATA__ <foo> <bar>4</bar> <bar>1</bar> <bar>3</bar> <bar>2</bar> <bar>5</bar> </foo>
UPDATE: now that i can see the spot, try this foreach instead: (untested)
Where you replace THIS with the XML tag you want to sort by.for my $this (sort {$a->{THIS} cmp $b->{THIS} } @{$xml->{policies}}) {
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: XML::Simple Not Sorting
by bkiahg (Pilgrim) on Jun 25, 2004 at 19:29 UTC | |
|
Re^2: XML::Simple Not Sorting
by bkiahg (Pilgrim) on Jun 25, 2004 at 20:28 UTC | |
by jeffa (Bishop) on Jun 25, 2004 at 20:32 UTC |