[Chicago-talk] Combine like hash elements

richard at rushlogistics.com richard at rushlogistics.com
Mon Nov 23 08:10:41 PST 2015


I have a hash reference with the following structure:

{
'11' => {'AMOUNT' => '20.00','ID' => '11','NAME' => 'Lincoln Park'},
'12' => {'AMOUNT' => '38.00','ID' => '12','NAME' => 'Bucktown'},
'13' => {'AMOUNT' => '41.00','ID' => '12','NAME' => 'Lincoln Park'}
}

Can anyone tell me how I can combine them by 'NAME' so that I would have:

{
'11' => {'AMOUNT' => '61.00','ID' => '11','NAME' => 'Lincoln Park'},
'12' => {'AMOUNT' => '38.00','ID' => '12','NAME' => 'Bucktown'},
}

Thanks


More information about the Chicago-talk mailing list