I have no example at hand where the two operands would be treated differently. However, this isn't as redundant as it might look. Syntactically, it is an expression with a binary comparison operator. This can be parsed and executed as a code block by the Perl interpreter. If you want to avoid specifying one of the operands you'd need a new syntax where you can specify a function operating on one of the values from the list, a comparison operator, and also, whether you want ascending or descending order. But such a syntax doesn't cover all use cases: You can also compare like sort {my_function($a,$b)} which has no redundancy, and no visible comparison operator.
In reply to Re: Notation of sort function
by haj
in thread Notation of sort function
by Alphaphi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |