After reading a csv file, I have this data structure:
[["name1 | value1 | value2 | value3 | value4 "],
["name2 | value1 | value2 | value3 | value4 "],...]
I need to convert this to a Hash, like this:
{"name1" => "value1 | value2 | value3 | value4",
"name2" => "value1 | value2 | value3 | value4",...}
Or, better yet:
{"name1" => ["value1","value2","value3","value4"],
"name2" => ["value1","value2","value3","value4"],...}
I have found numerous methods for converting arrays of arrays to hashes, but none that take the first element in the inner array and use it as the key of the Hash.
Can anyone suggest an elegant solution?