So yeah, I have this nice little hash:
So yeah, when I print it directly after the definition, it's already rearranged to this:
So yeah, you'd greatly help me by telling me how I keep the hashes order I assign (though I figure that's not really possible since they don't have index numbers, huh...) or how the self-arranging thing works... like some kind of algorhytm.
My suspection as of now is that I need to convert it to an Array to use the sort method... or is there another method?
Code:
testhash = {'value_01' => 1,
'value_AX' => 23,
'value_06' => 5,
'seperator1' => '-----',
'value_04' => 112}
Well, I would try to understand what's going on, but I have no idea based on what facts they'd rearrange themselves... until this one, I was sure that string-containing keys were ordered after integer-containing keys, but I guess this hash proves me wrong even with that...{"value_01" => 1, "value_AX" => 23, "value_04" => 112, "seperator1" => "-----", "value_06" => 5}
So yeah, you'd greatly help me by telling me how I keep the hashes order I assign (though I figure that's not really possible since they don't have index numbers, huh...) or how the self-arranging thing works... like some kind of algorhytm.
My suspection as of now is that I need to convert it to an Array to use the sort method... or is there another method?