Nico Ritsche wrote: > Rodrigo Kochenburger wrote: >>> pi_array_sorted = >>> { 'general_event_types', [GeneralEventType1, GeneralEventType2, ..], >>> 'prices', [Price1, Price2, ..], >>> 'specific_event_types', [SpecificEventType1, SpecificEventType2, ..], >>> 'general_event_types', [Teacher1, Teacher2, ..] } >>> > Nico Nico, We can help but you must strive to explain what you want clearly and legibly.. For the pi_array_sorted, it appears that you want to convert a hash of arrays into an array of arrays where the second arrays is sorted. Here is a solution that sorts the nested arrays and then the initial array irb(main):002:0> a = {1=>[3,7,1,7], 2=>[3,7,1,1],3=>[3,2,2,9]} => {1=>[3, 7, 1, 7], 2=>[3, 7, 1, 1], 3=>[3, 2, 2, 9]} irb(main):003:0> a.each {|b,c| c.sort!} => {1=>[1, 3, 7, 7], 2=>[1, 1, 3, 7], 3=>[2, 2, 3, 9]} irb(main):004:0> a.sort => [[1, [1, 3, 7, 7]], [2, [1, 1, 3, 7]], [3, [2, 2, 3, 9]]] hth If it doesn't then write the code EXACTLY as you have it.. and then the exact output that you desire and we will code it for you.. The code that you submitted is barely readable and leaves a lot open to interpretation. ilan -- Posted via http://www.ruby-forum.com/.