|
|
| Problems? Is your data what you think it is? | |
| PerlMonks |
Re: Notation of sort functionby Jenda (Abbot) |
| on Oct 28, 2023 at 15:44 UTC ( [id://11155254]=note: print w/replies, xml ) | Need Help?? |
|
Because we are not just specifying what part(s) of the elements do we want to compare, but also how! cmp may be fine for you English speaking dudes, but it's basically useless to the rest of the world. Besides even if we did keep to cmp and <=>, what's some other, reasonably succinct and reasonably comprehensible way to write sort {$a->{age} <=> $a->{age} || $b->{name} cmp $a->{name}} @array ? What is the operation you'd want to apply to the elements so that you can then sort the results using one of the only two types of comparisons you seem to want to get restricted to? Jenda
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||