[Milan-pm] PErl Test

Hakim Cassimally hakim.cassimally at gmail.com
Tue Mar 24 10:09:23 PDT 2009


2009/3/24 marcos rebelo <oleber at gmail.com>

> On Tue, Mar 24, 2009 at 5:54 PM, Michele Beltrame <mb at cattlegrid.info>
> wrote:
> > I would say number 14 could be changed a bit, as keys() might return
> > keys in any order, so arrays shown as options could not be correct as
> > far as ordering is concerned.
>
> before there was a sort in there. You don't imagine the casino in the
> Lisbon PM, the alphabetic order, ...
>
> So at the end, this is the only possible answer.


Except that without the sort the answer is wrong, and with the sort the
answer is right ;-)

DB<6> @a{1,2,19,6,2,6}=(1..6); print Dumper([ sort keys %a
]);
$VAR1 = ['1','19','2','6'];

You could try sort { $a <=> $b } keys %a to be clearer?
osf'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/milan-pm/attachments/20090324/ae157067/attachment.html>


More information about the Milan-pm mailing list