in reply to Re^2: Sort mechanics problems with objects and potentially contradicting comparisons (would cause infinite loop)
in thread Sort mechanics problems with objects and potentially contradicting comparisons (would cause infinite loop)

If you pass $a and $b explicitly, you might be able to reuse that sub outside of sort. The "efficiency" of the implicit $a and $b is not really a big deal.

$obj->_compare($a,$b)
  • Comment on Re^3: Sort mechanics problems with objects and potentially contradicting comparisons (would cause infinite loop)
  • Download Code

Replies are listed 'Best First'.
Re^4: Sort mechanics problems with objects and potentially contradicting comparisons (would cause infinite loop)
by anonymized user 468275 (Curate) on Jun 01, 2016 at 16:21 UTC
    It's not about efficiency. If $a and $b can't be relied on, any such use of the sort mechanism becomes definitively non-standard and the sort keyword would have to be avoided.

    One world, one people

      They can be relied on, but they have scoping problems and can be confusing when your program spans multiple packages (see hakuex's edit).