Is there a clear way to loop through the hash below and replace the specific value(s) with the value(s) in the 'Fills' array?
codes = ['AA', 'BB']
fills = ['FOUR', 'FIVE']
This empty hash gets populated by an 'each do' statement where is picks out the info from 'main_hash' based on the keys in the 'codes' array.
hash = {}
main_hash = {'AA' => ['1', 'TEXT', 'ONE'],
'BB' => ['2', 'TEXT', 'TWO'],
'CC' => ['3', 'TEXT', 'THREE']}
Ouput: I want to replace the specific value in the new 'hash' so the output looks like below:
hash = {'AA' => ['1', 'TEXT', 'FOUR'],
'BB' => ['2', 'TEXT', 'FIVE']}