<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks Micha!<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Once again, CPAN to the rescue. But how do you find the right module???<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>As for this Hash::Merge package, it seems a cannon, and all I needed was to kill a mosquito… <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Regards to all,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Meir<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> perl-bounces@perl.org.il [mailto:perl-bounces@perl.org.il] <b>On Behalf Of </b>Micha<br><b>Sent:</b> </span><span lang=HE dir=RTL style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>יום&nbsp;ג 30 אוקטובר 2012 18:22</span><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><br><b>To:</b> Perl in Israel<br><b>Subject:</b> Re: [Israel.pm] Importing values from a 2D hash into another 2D hash<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><o:p>&nbsp;</o:p></p><p class=MsoNormal style='margin-left:36.0pt'>maybe:<o:p></o:p></p><div style='margin-left:30.0pt'><p class=MsoNormal style='margin-left:36.0pt'>use Hash::Merge qw(merge);<br>%combined_hash = %{ merge( \%combined_hash, \%added_hash ) };<o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt'><br>Cheers,<br>Micha<o:p></o:p></p><div><p class=MsoNormal style='margin-left:36.0pt'>On Tue, Oct 30, 2012 at 3:47 PM, Meir Guttman &lt;<a href="mailto:meir@guttman.co.il" target="_blank">meir@guttman.co.il</a>&gt; wrote:<o:p></o:p></p><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:36.0pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thank you Sawyer and Ran. Intriguing… </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:36.0pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>But I was thinking about something akin to how one combines two simple hashes as:</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt'><b><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>%combined_hash = (%combined_hash, %added_hash);</span></b><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:36.0pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>(This of course overwrites same-key records, but in my application this is a “feature” and a bonus... </span><span style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'>J</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>)</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:36.0pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>My problem was that I was lost and couldn’t figure out how to deal with all these references to anonymous inner hashes. </span><span style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'>L</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:36.0pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Meir</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:36.0pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>&nbsp;</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:36.0pt'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>&nbsp;</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt'><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <a href="mailto:perl-bounces@perl.org.il" target="_blank">perl-bounces@perl.org.il</a> [mailto:<a href="mailto:perl-bounces@perl.org.il" target="_blank">perl-bounces@perl.org.il</a>] <b>On Behalf Of </b>sawyer x<br><b>Sent:</b> </span><span lang=HE dir=RTL style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>יום</span><span dir=LTR></span><span dir=LTR></span><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><span dir=LTR></span><span dir=LTR></span>&nbsp;</span><span lang=HE dir=RTL style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>ב</span><span lang=HE dir=RTL style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> </span><span dir=LTR></span><span dir=LTR></span><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><span dir=LTR></span><span dir=LTR></span>29 </span><span lang=HE dir=RTL style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>אוקטובר</span><span lang=HE dir=RTL style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> </span><span dir=LTR></span><span dir=LTR></span><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><span dir=LTR></span><span dir=LTR></span>2012 21:07<br><b>To:</b> Perl in Israel<br><b>Subject:</b> Re: [Israel.pm] Importing values from a 2D hash into another 2D hash</span><o:p></o:p></p><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt'>&nbsp;<o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt;margin-left:72.0pt'>Booya!<o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt'>On Mon, Oct 29, 2012 at 9:04 PM, Ran Eilam &lt;<a href="mailto:ran.eilam@gmail.com" target="_blank">ran.eilam@gmail.com</a>&gt; wrote:<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt'>Returning a new value instead of mutating the sub arguments:<br><br>sub combine_values {<br>&nbsp; my $old = shift;<br>&nbsp; my $new &nbsp;= shift;<br>&nbsp; return map {$_ =&gt; {<br>&nbsp; &nbsp; &nbsp; %{ $old-&gt;{$_} },<br>&nbsp; &nbsp; &nbsp; %{ $new-&gt;{$_} || {} }<br>&nbsp; }} keys %$old;<br>}<br><span style='color:#888888'><br>Ran</span><o:p></o:p></p><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt'>_______________________________________________<br>Perl mailing list<br><a href="mailto:Perl@perl.org.il" target="_blank">Perl@perl.org.il</a><br><a href="http://mail.perl.org.il/mailman/listinfo/perl" target="_blank">http://mail.perl.org.il/mailman/listinfo/perl</a><o:p></o:p></p></div></div></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt'>&nbsp;<o:p></o:p></p></div></div></div></div></div><p class=MsoNormal style='margin-left:36.0pt'><br>_______________________________________________<br>Perl mailing list<br><a href="mailto:Perl@perl.org.il">Perl@perl.org.il</a><br><a href="http://mail.perl.org.il/mailman/listinfo/perl" target="_blank">http://mail.perl.org.il/mailman/listinfo/perl</a><o:p></o:p></p></div><p class=MsoNormal style='margin-left:36.0pt'><o:p>&nbsp;</o:p></p></div></body></html>