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;">
it is correct now<br>
<div class="im"></div></blockquote><div><br>Correct how?<br><br>use strict; use warnings;<br>use Data::Dumper;<br>use Test::More tests =&gt; 1;<br><br>my %a;<br>@a{1,2,19,6,2,6}=(1..6);<br>my $keys = [ keys %a ];<br><br>
is_deeply<br>    $keys,<br>    [ 1, 19, 2, 6 ],<br>    &#39;<a href="http://milan.pm.org/perl_test.html">http://milan.pm.org/perl_test.html</a>, question 14&#39;<br>    or diag Dumper $keys;<br><br>####<br>1..1<br>not ok 1 - <a href="http://milan.pm.org/perl_test.html">http://milan.pm.org/perl_test.html</a>, question 14<br>
#   Failed test &#39;<a href="http://milan.pm.org/perl_test.html">http://milan.pm.org/perl_test.html</a>, question 14&#39;<br>#   at isd.pl line 11.<br>#     Structures begin differing at:<br>#          $got-&gt;[0] = &#39;6&#39;<br>
#     $expected-&gt;[0] = &#39;1&#39;<br># $VAR1 = [<br>#           &#39;6&#39;,<br>#           &#39;1&#39;,<br>#           &#39;19&#39;,<br>#           &#39;2&#39;<br>#         ];<br># Looks like you failed 1 test of 1<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 class="im"><br>
2009/3/24 Hakim Cassimally &lt;<a href="mailto:hakim.cassimally@gmail.com">hakim.cassimally@gmail.com</a>&gt;:<br>
</div><div><div></div><div class="h5">&gt; 2009/3/24 marcos rebelo &lt;<a href="mailto:oleber@gmail.com">oleber@gmail.com</a>&gt;<br>
&gt;&gt;<br>
&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; wrote:<br>
&gt;&gt; &gt; I would say number 14 could be changed a bit, as keys() might return<br>
&gt;&gt; &gt; keys in any order, so arrays shown as options could not be correct as<br>
&gt;&gt; &gt; far as ordering is concerned.<br>
&gt;&gt;<br>
&gt;&gt; before there was a sort in there. You don&#39;t imagine the casino in the<br>
&gt;&gt; Lisbon PM, the alphabetic order, ...<br>
&gt;&gt;<br>
&gt;&gt; So at the end, this is the only possible answer.<br>
&gt;<br>
&gt; Except that without the sort the answer is wrong, and with the sort the<br>
&gt; answer is right ;-)<br>
&gt;<br>
&gt; DB&lt;6&gt; @a{1,2,19,6,2,6}=(1..6); print Dumper([ sort keys %a<br>
&gt; ]);<br>
&gt; $VAR1 = [&#39;1&#39;,&#39;19&#39;,&#39;2&#39;,&#39;6&#39;];<br>
&gt;<br>
&gt; You could try sort { $a &lt;=&gt; $b } keys %a to be clearer?<br>
&gt; osf&#39;<br>
</div></div></blockquote></div><br>