I am currently trying to use hashes in an array to find the keys and values of each specific item in the array. I am able to do this and both the keys and the values are separate when I haven't sorted the array, but when I create a sorted array such as:
my @sorted_pairs = %counts{$word}.sort(*.value);
It binds the values together. Is there a method for sorted hash values that allow the pairs to be split into separate entities within the array? I want to be able to access the "word" string and the count or number of times that word was seen as an integer, separately.
I am using this source as a reference. I have tried a handful of these methods and while it does seem to sort the array by numeric value given the output:
sorted array : [do => 1 rest => 1 look => 1 wanted => 1 give => 1 imagine => 2 read => 2 granted => 2 ever => 2 love => 2 gonna => 2 feel => 2 meant => 2 like => 2 you => 2 live => 3 wrote => 3 come => 3 know => 3 are => 3 mom => 4]
it doesn't separate the key and value from one another.