hi:

i want sort my array .but the result is not right. i did not know   why ?

---------------------------------------begin
code----------------------------------------------
perl -e '

@AoH = (
    {
       rsh => "0.4",
    },
    {
       telnet=> "0.022",
    },

    {
       ssh => "0.3",
    },
  );
  print values($_) for sort my_sort @AoH; sub my_sort {
values($a)<=>values($b)}
'
----------------------------------end
code---------------------------------------------------------

the result is 0.40.0220.3  apparently it did not right!

after i  modify my_sort to this
sub my_sort { (values($a))[0]<=>(values($b))[0]}
it can work well ..

anyone can tell me the reason!

tanks!

-- 
继续上路。。

Reply via email to