It's a good question. There are cases where one might want to apply different conditions on the operands or where one of the operands isn't $a or $b at all. These cases are rare but they do crop up from time to time.
I have had a trawl through some code of mine and haven't found one yet. Closest I have is this:
@abc = sort { length ($b) <=> length ($a) || $a cmp $b } @abc;
Even through here we are treating $a and $b in the same way, I don't know how you would express this without the flexibility that the current syntax gives. It would not be as succinct, that's for sure.
🦛
In reply to Re: Notation of sort function
by hippo
in thread Notation of sort function
by Alphaphi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |