in reply to Re^2: Sorting an array of hashes with an exeption
in thread Sorting an array of hashes with an exception

It looks like it sorts by RouteDistance only here.
Not really. Try setting Distance to 3.1 at ID 5.
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
  • Comment on Re^3: Sorting an array of hashes with an exeption

Replies are listed 'Best First'.
Re^4: Sorting an array of hashes with an exeption
by martin_87 (Initiate) on May 09, 2013 at 16:06 UTC

    You're right, It doesn't only sort by RouteDistance. I didn't look long enough at the code, just the result. My bad.

    The result when changing ID: 5 with a distance of: 3.1 I get the following result:

    ID: 1 Distance: 1.7 RouteDistance: 2.5
    ID: 5 Distance: 3.1 RouteDistance: 0
    ID: 2 Distance: 1.5 RouteDistance: 2.8
    ID: 3 Distance: 2.3 RouteDistance: 4.3

    This is my excpected result but then again, it will not work in all cases :/

      Ouch, I had a precedence error in the code. Fixed now with the parentheses.
      لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ