in reply to Re^2: XML::Simple Not Sorting
in thread XML::Simple Not Sorting

Try this:

use Data::Dumper; for ( sort { $a->{policy_number} cmp $b->{policy_number}} @{ $VAR1->{p +olicies} }) { print Dumper $_; }
Which yielded the following for me: (even though the data was already sorted by 'policy_number')
$VAR1 = { 'name' => 'ZAbc', 'description' => 'This is where the description goes.', 'link_name' => '7080-A103 zAbc.doc', 'policy_number' => '7080-A103' }; $VAR1 = { 'name' => 'Def', 'description' => 'This is where the description goes.', 'link_name' => '7080-D100 ef.doc', 'policy_number' => '7080-D100' }; $VAR1 = { 'name' => 'Pqrs', 'description' => 'This is where the description goes.', 'link_name' => '7080-E102 Pqrs.doc', 'policy_number' => '7080-E102' };

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)