in reply to I don't understand why keys %hash does this ...

The monks have pointed out that hash order is not preserved. I just want to point out that one method I often use to preserve the order of the input hash is to use an intermediate array:

#!/usr/bin/perl use strict; use Data::Dumper; my %HoTypes = my @HoTypes = ( 'PythonQuestions' => [ '[PythonQuestions|Python Questions]', 318, +3, 10 ], 'OffTopics' => [ '[OffTopics|Off Topic Post]', 500, +3, 10 ], 'notes' => [ 'Notes', 283, +3, 20 ] ); # retrieve the keys in the original order @HoTypes = @HoTypes[map { $_ % 2 ? () : $_ } 0..$#HoTypes]; # and use the keys recorded in the array for my $T ( @HoTypes ) { my $nodeStr = $HoTypes{$T}[0]; print "$T -> $nodeStr\n"; }