[% FOREACH key_1 IN my_hash.keys.sort.reverse %] [% FOREACH key_2 IN my_hash.$key_1.keys.sort.reverse %] output something [%END%] [%END%]