# Get an arbitrary top level key and use it to # create an ordered array of the sub hash keys # my $anyKey = keys %{ $hashref1 }; # my @sortedKeys = sort keys %{ $hashref1->{ $anyKey } }; # Create an array of keys in the order you want them { ## Suppress 'Possible attempt to put comments in qw() list at ...' ## because of the key: '#' no warnings 'qw'; my @sortedKeys = qw[ Cardiology Neurology All_sum call_date Gastroenterology General # Radiology ]; }