<div dir="ltr">I am guessing there is a typo in the sample input data. In the third entry, isn't the key and ID value supposed to be the same? Is it supposed to be 11 or 13? If it is the way it is or if it really is 13, then you need to arbitrate which key and/or ID the resulting hash will have.<div><br></div><div><span style="font-size:12.8px">{</span><br style="font-size:12.8px"><span style="font-size:12.8px">'11' => {'AMOUNT' => '20.00','ID' => '11','NAME' => 'Lincoln Park'},</span><br style="font-size:12.8px"><span style="font-size:12.8px">'12' => {'AMOUNT' => '38.00','ID' => '12','NAME' => 'Bucktown'},</span><br style="font-size:12.8px"><span style="font-size:12.8px">'13' => {'AMOUNT' => '41.00','ID' => '12','NAME' => 'Lincoln Park'}</span><br style="font-size:12.8px"><span style="font-size:12.8px">}</span><br></div><div><span style="font-size:12.8px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 23, 2015 at 10:38 AM, Andy Lester <span dir="ltr"><<a href="mailto:andy@petdance.com" target="_blank">andy@petdance.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><span class=""><div><blockquote type="cite"><blockquote style="font-family:Georgia;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;border-left-width:2px;border-left-style:solid;border-left-color:rgb(0,0,0);padding-right:0px;padding-left:5px;margin-left:5px;margin-right:0px"><div><div class="gmail_extra"><div class="gmail_quote">{<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">'11' => {'AMOUNT' => '20.00','ID' => '11','NAME' => 'Lincoln Park'},<br>'12' => {'AMOUNT' => '38.00','ID' => '12','NAME' => 'Bucktown'},<br>'13' => {'AMOUNT' => '41.00','ID' => '12','NAME' => 'Lincoln Park'}<br>}<br><br>Can anyone tell me how I can combine them by 'NAME' so that I would have:<br><br>{<br>'11' => {'AMOUNT' => '61.00','ID' => '11','NAME' => 'Lincoln Park'},<br>'12' => {'AMOUNT' => '38.00','ID' => '12','NAME' => 'Bucktown'},<br>}<br></blockquote></div></div></div></blockquote></blockquote></div><div><br></div></span><div><div><span class=""><blockquote type="cite"><div>On Nov 23, 2015, at 10:36 AM, <a href="mailto:richard@rushlogistics.com" target="_blank">richard@rushlogistics.com</a> wrote:</div><br><div><div style="margin:0px;padding:0px">Did not include it because it did not come close but if you must see it here it is:</div><p style="margin:0px;padding:0px"> </p><div style="margin:0px;padding:0px"> %$w_ref = sort { %$w_ref{$a} <=> %$w_ref{$b} } keys %$w_ref;</div></div></blockquote><div><div><div style="margin:0px;padding:0px"><br></div></div></div></span><div style="margin:0px;padding:0px">What that’s doing is sorting.  There’s no combining going on.  You’re going to need to write something that goes through your hash values and finds the ones that have the same name and add the AMOUNTs together.</div></div></div><div><br></div><br><div>
--<br>Andy Lester => <a href="http://www.petdance.com" target="_blank">www.petdance.com</a>

</div>
<br></div><br>_______________________________________________<br>
Chicago-talk mailing list<br>
<a href="mailto:Chicago-talk@pm.org">Chicago-talk@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/chicago-talk" rel="noreferrer" target="_blank">http://mail.pm.org/mailman/listinfo/chicago-talk</a><br></blockquote></div><br></div>