[Chicago-talk] Combine like hash elements

Shawn Carroll shawn.c.carroll at gmail.com
Mon Nov 23 08:17:39 PST 2015


At the risk of sounding like StackOverflow, what have you tried?


shawn.c.carroll at gmail.com
Software Engineer
Soccer Referee

On Mon, Nov 23, 2015 at 10:10 AM, <richard at rushlogistics.com> wrote:

> 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
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/chicago-talk/attachments/20151123/1aa4e3e0/attachment.html>


More information about the Chicago-talk mailing list