http://www.perlmonks.org?node_id=601207

willfould has asked for the wisdom of the Perl Monks concerning the following question:

The following script produces unexpected results.. can someone identify why the sorted order is reversed? - W
---------------------------- #!/usr/local/bin/perl my(%test,$j)=(); $test{'2007030110300020070301133000'}++; $test{'2007030110300020070301143000'}++; foreach $j (sort{$a<=>$b}(keys(%test))) { print "Key: $j\n"; } ------- results ------ [root@localhost]# perl test_sorting.pl Key: 2007030110300020070301143000 Key: 2007030110300020070301133000