use warnings; use strict; use XML::Twig; use Tie::IxHash; my $tw = XML::Twig->new("keep_atts_order", 1); my %atts; tie %atts, Tie::IxHash::; # <----- %atts = ("year", 2010, "month", 3, "day", 5); $tw->set_root(XML::Twig::Elt->new("date", \%atts)); $tw->flush; print "\n"; __END__