On Tue, Mar 18, 2008 at 9:46 AM, Jay Hannah <<a href="mailto:jhannah@omnihotels.com">jhannah@omnihotels.com</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><br><div><font face="Courier New" size="2">reverse() is neat. I didn't know/remember
that Perl function. :)</font></div></div></blockquote><div><br>And for those of you wondering (like I was), here's what happens when you run it with multiple values on the right side of the => sign...<br><br><b>Code:</b><br>
use Data::Dumper;<br>use strict;<br>use warnings;<br>my %a2b = ( A=>000, B=>001, C=>001, D=>002 );<br>printf ("Original:\n");<br>printf Dumper(\%a2b);<br><br>my %b2a = reverse %a2b;<br>printf ("\n======================\nReversed:\n");<br>
printf Dumper(\%b2a);<br><br>printf ("Done!\n");<br><br><br><b>Output:</b><br>Original:<br>$VAR1 = {<br> 'A' => 0,<br> 'D' => 2,<br> 'C' => 1,<br> 'B' => 1<br>
};<br><br>======================<br>Reversed:<br>$VAR1 = {<br> '1' => 'C',<br> '0' => 'A',<br> '2' => 'D'<br> };<br>Done!<br>
<br><b>RESULT:</b><br><u>"There can be only one</u>" (to be expected with a hash variable), but there aren't any warnings that appear when there are multiple values. I'm not certain if it is 'last one wins' (last being last one defined in original hash), or 'first one wins' (first being the first as stored in memory and shown in the Dumper output)...<br>
<br>Dan<br> <br></div></div>-- <br>"Quis custodiet ipsos custodes?" (Who can watch the watchmen?) -- from the Satires of Juvenal<br>"I do not fear computers, I fear the lack of them." -- Isaac Asimov (Author)<br>
** *** ***** ******* *********** *************