2009/3/24 marcos rebelo <span dir="ltr">&lt;<a href="mailto:oleber@gmail.com">oleber@gmail.com</a>&gt;</span><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;">
refresh<br>
<div><div></div><div class="h5"></div></div></blockquote><div><br>Ah!  Apologies, I did think to refresh, but apparently I can&#39;t drive Firefox...<br>Thanks ;-)<br><br>osf&#39;<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div class="h5"><br>
2009/3/24 Hakim Cassimally &lt;<a href="mailto:hakim.cassimally@gmail.com">hakim.cassimally@gmail.com</a>&gt;:<br>
&gt; 2009/3/24 marcos rebelo &lt;<a href="mailto:oleber@gmail.com">oleber@gmail.com</a>&gt;<br>
&gt;&gt;<br>
&gt;&gt; it is correct now<br>
&gt;<br>
&gt; Correct how?<br>
&gt;<br>
&gt; use strict; use warnings;<br>
&gt; use Data::Dumper;<br>
&gt; use Test::More tests =&gt; 1;<br>
&gt;<br>
&gt; my %a;<br>
&gt; @a{1,2,19,6,2,6}=(1..6);<br>
&gt; my $keys = [ keys %a ];<br>
&gt;<br>
&gt; is_deeply<br>
&gt;     $keys,<br>
&gt;     [ 1, 19, 2, 6 ],<br>
&gt;     &#39;<a href="http://milan.pm.org/perl_test.html" target="_blank">http://milan.pm.org/perl_test.html</a>, question 14&#39;<br>
&gt;     or diag Dumper $keys;<br>
&gt;<br>
&gt; ####<br>
&gt; 1..1<br>
&gt; not ok 1 - <a href="http://milan.pm.org/perl_test.html" target="_blank">http://milan.pm.org/perl_test.html</a>, question 14<br>
&gt; #   Failed test &#39;<a href="http://milan.pm.org/perl_test.html" target="_blank">http://milan.pm.org/perl_test.html</a>, question 14&#39;<br>
&gt; #   at isd.pl line 11.<br>
&gt; #     Structures begin differing at:<br>
&gt; #          $got-&gt;[0] = &#39;6&#39;<br>
&gt; #     $expected-&gt;[0] = &#39;1&#39;<br>
&gt; # $VAR1 = [<br>
&gt; #           &#39;6&#39;,<br>
&gt; #           &#39;1&#39;,<br>
&gt; #           &#39;19&#39;,<br>
&gt; #           &#39;2&#39;<br>
&gt; #         ];<br>
&gt; # Looks like you failed 1 test of 1<br>
&gt;<br>
&gt; osf&#39; ;-)<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; 2009/3/24 Hakim Cassimally &lt;<a href="mailto:hakim.cassimally@gmail.com">hakim.cassimally@gmail.com</a>&gt;:<br>
&gt;&gt; &gt; 2009/3/24 marcos rebelo &lt;<a href="mailto:oleber@gmail.com">oleber@gmail.com</a>&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; On Tue, Mar 24, 2009 at 5:54 PM, Michele Beltrame &lt;<a href="mailto:mb@cattlegrid.info">mb@cattlegrid.info</a>&gt;<br>
&gt;&gt; &gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt; I would say number 14 could be changed a bit, as keys() might return<br>
&gt;&gt; &gt;&gt; &gt; keys in any order, so arrays shown as options could not be correct as<br>
&gt;&gt; &gt;&gt; &gt; far as ordering is concerned.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; before there was a sort in there. You don&#39;t imagine the casino in the<br>
&gt;&gt; &gt;&gt; Lisbon PM, the alphabetic order, ...<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; So at the end, this is the only possible answer.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Except that without the sort the answer is wrong, and with the sort the<br>
&gt;&gt; &gt; answer is right ;-)<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; DB&lt;6&gt; @a{1,2,19,6,2,6}=(1..6); print Dumper([ sort keys %a<br>
&gt;&gt; &gt; ]);<br>
&gt;&gt; &gt; $VAR1 = [&#39;1&#39;,&#39;19&#39;,&#39;2&#39;,&#39;6&#39;];<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; You could try sort { $a &lt;=&gt; $b } keys %a to be clearer?<br>
&gt;&gt; &gt; osf&#39;<br>
&gt;<br>
&gt;<br>
</div></div><div><div></div><div class="h5">&gt; _______________________________________________<br>
&gt; Milan-pm mailing list<br>
&gt; <a href="mailto:Milan-pm@pm.org">Milan-pm@pm.org</a><br>
&gt; <a href="http://mail.pm.org/mailman/listinfo/milan-pm" target="_blank">http://mail.pm.org/mailman/listinfo/milan-pm</a><br>
&gt;<br>
&gt;<br>
<br>
<br>
<br>
--<br>
Marcos Rebelo<br>
<a href="http://oleber.freehostia.com" target="_blank">http://oleber.freehostia.com</a><br>
Milan Perl Mongers leader <a href="http://milan.pm.org" target="_blank">http://milan.pm.org</a><br>
_______________________________________________<br>
Milan-pm mailing list<br>
<a href="mailto:Milan-pm@pm.org">Milan-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/milan-pm" target="_blank">http://mail.pm.org/mailman/listinfo/milan-pm</a><br>
</div></div></blockquote></div><br>