I have a sorted hash that I'm converting to two separate arrays, one with keys, one values, how do i keep the arrays sorted like the hash through the process of being converted? I want to be able to use for example array1[0] and array2[0] knowing that they are a key/value pair in the hash. This is how im converting my hash:
my @array1 = keys %hash;
my @array2 = values %hash;
And now the elements of array1 & array2 doesn't display the information in the same order that printing out the sorted key/values would. Is there a way to keep the arrays sorted in the same way as the hash, by value?