2009/3/24 marcos rebelo <span dir="ltr"><<a href="mailto:oleber@gmail.com">oleber@gmail.com</a>></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 => 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> '<a href="http://milan.pm.org/perl_test.html">http://milan.pm.org/perl_test.html</a>, question 14'<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 '<a href="http://milan.pm.org/perl_test.html">http://milan.pm.org/perl_test.html</a>, question 14'<br># at isd.pl line 11.<br># Structures begin differing at:<br># $got->[0] = '6'<br>
# $expected->[0] = '1'<br># $VAR1 = [<br># '6',<br># '1',<br># '19',<br># '2'<br># ];<br># Looks like you failed 1 test of 1<br>
<br>osf' ;-)<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 <<a href="mailto:hakim.cassimally@gmail.com">hakim.cassimally@gmail.com</a>>:<br>
</div><div><div></div><div class="h5">> 2009/3/24 marcos rebelo <<a href="mailto:oleber@gmail.com">oleber@gmail.com</a>><br>
>><br>
>> On Tue, Mar 24, 2009 at 5:54 PM, Michele Beltrame <<a href="mailto:mb@cattlegrid.info">mb@cattlegrid.info</a>><br>
>> wrote:<br>
>> > I would say number 14 could be changed a bit, as keys() might return<br>
>> > keys in any order, so arrays shown as options could not be correct as<br>
>> > far as ordering is concerned.<br>
>><br>
>> before there was a sort in there. You don't imagine the casino in the<br>
>> Lisbon PM, the alphabetic order, ...<br>
>><br>
>> So at the end, this is the only possible answer.<br>
><br>
> Except that without the sort the answer is wrong, and with the sort the<br>
> answer is right ;-)<br>
><br>
> DB<6> @a{1,2,19,6,2,6}=(1..6); print Dumper([ sort keys %a<br>
> ]);<br>
> $VAR1 = ['1','19','2','6'];<br>
><br>
> You could try sort { $a <=> $b } keys %a to be clearer?<br>
> osf'<br>
</div></div></blockquote></div><br>