In this code:
my %h;
my @toBeMoved = sort {$a <=> $b} grep {++$h{$_} == 1} @toBeMoved;
the value associated with each element is incremented (not set to 1, that's important). So the grep block will only return a true value the first time a value is seen. E.g., the first time 133 is seen, ++$h{133} == 1 will be true. The second time 133 is seen, the block will return a false value, since $h{133} will now be 2, not 1. The block will only return a true value once for each unique value. Does that clear things up at all?
-- Mike
--
XML::Simpler does not require XML::Parser or a SAX parser.
It does require File::Slurp.
-- grantm, perldoc XML::Simpler